Skip to content

Testdata for Pool1d layer support #820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added testdata/dnn/onnx/data/input_average_pooling_1d.npy
Binary file not shown.
Binary file not shown.
Binary file added testdata/dnn/onnx/data/input_maxpooling_1d.npy
Binary file not shown.
Binary file not shown.
Binary file added testdata/dnn/onnx/data/input_pool_conv_1d.npy
Binary file not shown.
Binary file added testdata/dnn/onnx/data/input_two_maxpooling_1d.npy
Binary file not shown.
Binary file added testdata/dnn/onnx/data/output_average_pooling_1d.npy
Binary file not shown.
Binary file not shown.
Binary file added testdata/dnn/onnx/data/output_maxpooling_1d.npy
Binary file not shown.
Binary file not shown.
Binary file added testdata/dnn/onnx/data/output_pool_conv_1d.npy
Binary file not shown.
Binary file added testdata/dnn/onnx/data/output_two_maxpooling_1d.npy
Binary file not shown.
56 changes: 56 additions & 0 deletions testdata/dnn/onnx/generate_onnx_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,3 +1155,59 @@ def forward(self, x):
input = Variable(torch.randn(1, 3, 7, 5))
save_data_and_model("average_pooling_dynamic_axes", input, ave_pool)
postprocess_model("models/average_pooling_dynamic_axes.onnx", [[1, 3, 'height', 'width']])

x = Variable(torch.randn(1, 3, 10))
max_pool = nn.MaxPool1d(kernel_size=(5), stride=1, padding=2, dilation=1)
save_data_and_model("maxpooling_1d", x, max_pool)

x = Variable(torch.randn(2, 3, 12))
maxpooling_sigmoid = nn.Sequential(
nn.MaxPool1d(kernel_size=4, stride=2, padding=(2), dilation=1),
nn.Sigmoid()
)
save_data_and_model("maxpooling_sigmoid_1d", x, maxpooling_sigmoid)

x = Variable(torch.randn(2, 3, 12))
maxpool2 = nn.Sequential(
nn.MaxPool1d(kernel_size=5, stride=1, padding=0, dilation=1),
nn.MaxPool1d(kernel_size=3, stride=1, padding=0, dilation=1)
)
save_data_and_model("two_maxpooling_1d", x, maxpool2)

x = Variable(torch.randn(1, 3, 7))
ave_pool = nn.AvgPool1d(kernel_size=3, stride=2, padding=1)
save_data_and_model("average_pooling_1d", x, ave_pool)

class PoolConv1d(nn.Module):

def __init__(self):
super(PoolConv1d, self).__init__()
self.pool = nn.MaxPool1d(3, stride=2, padding=1)
self.conv = nn.Conv1d(2, 2, kernel_size=3, stride=1, padding=1)

def forward(self, x):
x = self.pool(x)
y = self.conv(x)
return y

x = Variable(torch.randn(1, 2, 4))
model = PoolConv1d()
save_data_and_model("pool_conv_1d", x, model)

class Conv1ResizePoold(nn.Module):
def __init__(self):
super(Conv1ResizePoold, self).__init__()
self.pool = nn.MaxPool1d(3, stride=2, padding=1)
self.conv = nn.Conv2d(2, 2, kernel_size=3, stride=1, padding=1)

def forward(self, x):
batch_size = x.size(0)
channels = x.size(1)
x = self.conv(x)
x = x.view(batch_size, channels, -1)
y = self.pool(x)
return y

x = Variable(torch.randn(1, 2, 20, 20))
model = Conv1ResizePoold()
save_data_and_model("conv_resize_pool_1d", x, model)
Binary file added testdata/dnn/onnx/models/average_pooling_1d.onnx
Binary file not shown.
Binary file added testdata/dnn/onnx/models/conv_resize_pool_1d.onnx
Binary file not shown.
18 changes: 18 additions & 0 deletions testdata/dnn/onnx/models/maxpooling_1d.onnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pytorch1.6:�
N
01 MaxPool_0"MaxPool*
kernel_shape@�*
pads@@�*
strides@�torch-jit-exportZ
0




b
1




B
18 changes: 18 additions & 0 deletions testdata/dnn/onnx/models/maxpooling_sigmoid_1d.onnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pytorch1.6:�
N
01 MaxPool_0"MaxPool*
kernel_shape@�*
pads@@�*
strides@�

12 Sigmoid_1"Sigmoidtorch-jit-exportZ
0



 b
2



B
25 changes: 25 additions & 0 deletions testdata/dnn/onnx/models/pool_conv_1d.onnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pytorch1.6:�
N
03 MaxPool_0"MaxPool*
kernel_shape@�*
pads@@�*
strides@�
�
3
conv.weight
conv.bias4Conv_1"Conv*
dilations@�*
group�*
kernel_shape@�*
pads@@�*
strides@�torch-jit-export*B conv.biasJ�F�=�1��*GB conv.weightJ0'\���I�>񽇾�:>����=�U<٥��;���ћ�>�%�=%i�>f% �Z
0



b
4



B
Binary file added testdata/dnn/onnx/models/two_maxpooling_1d.onnx
Binary file not shown.