Skip to content

Commit ee2f20a

Browse files
committed
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
2 parents 822ee11 + 26b09e5 commit ee2f20a

10 files changed

+69
-0
lines changed
224 Bytes
Binary file not shown.
152 Bytes
Binary file not shown.
224 Bytes
Binary file not shown.
224 Bytes
Binary file not shown.
152 Bytes
Binary file not shown.
224 Bytes
Binary file not shown.

testdata/dnn/onnx/generate_onnx_models.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,3 +1607,38 @@ def save_data_and_paddle_model(model, name, input_data):
16071607
input_shape = [1, 2, 3, 4]
16081608
x = paddle.rand(input_shape, dtype="float32")
16091609
save_data_and_paddle_model(Resize_HumanSeg(), "resize_humanseg", x)
1610+
1611+
class SubFromConstBroadcast(nn.Module):
1612+
def __init__(self, *args, **kwargs):
1613+
super(SubFromConstBroadcast, self).__init__()
1614+
self.const = torch.randn(1, 3, dtype=torch.float32)
1615+
1616+
def forward(self, x):
1617+
return self.const - x
1618+
1619+
model = SubFromConstBroadcast()
1620+
input_ = Variable(torch.randn(2, 3, dtype=torch.float32))
1621+
save_data_and_model("sub_from_const_broadcast", input_, model)
1622+
1623+
class SubFromConstEltWise(nn.Module):
1624+
def __init__(self, *args, **kwargs):
1625+
super(SubFromConstEltWise, self).__init__()
1626+
self.const = torch.randn(1, 2, 3, 4, dtype=torch.float32)
1627+
1628+
def forward(self, x):
1629+
return self.const - x
1630+
1631+
model = SubFromConstEltWise()
1632+
input_ = Variable(torch.randn(1, 2, 3, 4, dtype=torch.float32))
1633+
save_data_and_model("sub_from_const_eltwise", input_, model)
1634+
1635+
class SubFromConst1(nn.Module):
1636+
def __init__(self, *args, **kwargs):
1637+
super(SubFromConst1, self).__init__()
1638+
1639+
def forward(self, x):
1640+
return 1 - x
1641+
1642+
model = SubFromConst1()
1643+
input_ = Variable(torch.randn(1, 2, 3, 4, dtype=torch.float32))
1644+
save_data_and_model("sub_from_const1", input_, model)
171 Bytes
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pytorch1.9:�
2+
;1
3+
Constant_0"Constant*
4+
value*J W@�@-�oy��
5+

6+
1
7+
02Sub_1"Subtorch-jit-exportZ
8+
0
9+

10+

11+
b
12+
2
13+

14+

15+
B

testdata/dnn/onnx/models/sub_from_const_eltwise.onnx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
pytorch1.9:�
2+
�1
3+
Constant_0"Constant*x
4+
value*lJ`�)h����Vg>]D���t8�����/�0?F��ko]��3���uI?�X�=.&����,��[W�����>a��Z]��ǒ�?�2V־�݂��
5+

6+
1
7+
02Sub_1"Subtorch-jit-exportZ
8+
0
9+

10+

11+

12+

13+
b
14+
2
15+

16+

17+

18+

19+
B

0 commit comments

Comments
 (0)