Skip to content

Commit 1bca31c

Browse files
committed
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
2 parents 1252b83 + 77b41e6 commit 1bca31c

16 files changed

+37
-0
lines changed
428 Bytes
Binary file not shown.
428 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
232 Bytes
Binary file not shown.
312 Bytes
Binary file not shown.
272 Bytes
Binary file not shown.
Binary file not shown.

testdata/dnn/onnx/generate_onnx_models.py

+37
Original file line numberDiff line numberDiff line change
@@ -986,3 +986,40 @@ def forward(self, x):
986986
x = Variable(torch.randn(1, 3, 2, 2))
987987
model = Scale()
988988
save_data_and_model("scale", x, model)
989+
990+
x = Variable(torch.randn(1, 3, 25))
991+
conv1d = nn.Conv1d(3, 2, kernel_size=3, padding=2, stride=2, dilation=2, bias=False)
992+
save_data_and_model("conv1d", x, conv1d)
993+
994+
x = Variable(torch.randn(1, 3, 25))
995+
conv1d = nn.Conv1d(3, 2, kernel_size=3, padding=0, stride=1, dilation=1, bias=True)
996+
save_data_and_model("conv1d_bias", x, conv1d)
997+
998+
class Conv1d(nn.Module):
999+
def forward(self, x, kernel):
1000+
out = F.conv1d(x, kernel, groups=1)
1001+
return out
1002+
1003+
x = Variable(torch.randn(2, 2, 10))
1004+
kernel = Variable(torch.randn(2, 2, 2))
1005+
model = Conv1d()
1006+
save_data_and_model_multy_inputs("conv1d_variable_w", model, x, kernel)
1007+
1008+
class Conv1dBias(nn.Module):
1009+
def forward(self, x, kernel, bias):
1010+
batch = x.size(0)
1011+
channel = x.size(1)
1012+
x = x.view(1, batch*channel, x.size(2))
1013+
kernel = kernel.view(batch*channel, 1, 2)
1014+
conv = nn.Conv1d(4, 4, kernel_size=2, bias=False, groups=4)
1015+
conv.weight = nn.Parameter(kernel)
1016+
conv.bias = nn.Parameter(bias)
1017+
out = conv(x)
1018+
out = out.view(batch, channel, out.size(2))
1019+
return out
1020+
1021+
x = Variable(torch.randn(2, 2, 5))
1022+
kernel = Variable(torch.randn(2, 2, 2))
1023+
bias = Variable(torch.randn(4))
1024+
model = Conv1dBias()
1025+
save_data_and_model_multy_inputs("conv1d_variable_wb", model, x, kernel, bias)

testdata/dnn/onnx/models/conv1d.onnx

297 Bytes
Binary file not shown.
325 Bytes
Binary file not shown.
225 Bytes
Binary file not shown.
1.36 KB
Binary file not shown.

0 commit comments

Comments
 (0)