Skip to content

Commit

Permalink
Add ignore storage_order attribute to onnx pooling parser. (#5781)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwfromm committed Jun 12, 2020
1 parent 0f3cfb8 commit f672639
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion python/tvm/relay/frontend/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def _impl_v1(cls, inputs, attr, params):
'kernel_shape': 'pool_size',
'pads': ('padding', 0)
},
ignores=['dilations'],
ignores=['dilations', 'storage_order'],
custom_check=dimension_constraint())(inputs, attr, params)


Expand Down
24 changes: 11 additions & 13 deletions tests/python/frontend/onnx/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -2187,20 +2187,18 @@ def verify_pooling(x_shape, kernel_shape, strides, pads, out_shape, mode, auto_p
else:
raise ValueError("Pool method {} is not supported.".format(mode))

pool_node = helper.make_node(
node_type, inputs=["x"], outputs=["y"], kernel_shape=kernel_shape, strides=strides)

if pads is None:
pool_node = helper.make_node(node_type,
inputs=["x"],
outputs=["y"],
kernel_shape=kernel_shape,
auto_pad=auto_pad,
strides=strides)
pad_attr = helper.make_attribute('auto_pad', auto_pad)
else:
pool_node = helper.make_node(node_type,
inputs=["x"],
outputs=["y"],
kernel_shape=kernel_shape,
pads=pads,
strides=strides)
pad_attr = helper.make_attribute('pads', pads)
pool_node.attribute.append(pad_attr)

if mode == 'max':
storage_attr = helper.make_attribute('storage_order', 0)
pool_node.attribute.append(storage_attr)

graph = helper.make_graph([pool_node],
"pooling_test",
Expand Down Expand Up @@ -2907,4 +2905,4 @@ def verify_roi_align(input_dims, num_roi, output_height, output_width, sampling_
test_mod()
test_xor()
test_max_roi_pool()
test_roialign()
test_roi_align()

0 comments on commit f672639

Please sign in to comment.