Skip to content
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

Support dynamic pads for Pad opset 11 #45

Merged
merged 25 commits into from
Jan 15, 2020
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f99b024
Fixes #17, update clip operator (#18)
xadupre Sep 4, 2019
34255d9
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Sep 5, 2019
f2191cc
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Sep 5, 2019
bd692b8
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Sep 6, 2019
42891d7
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Sep 27, 2019
398b45d
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Sep 30, 2019
48c0d20
Merge branch 'master' of https://github.com/jiafatom/onnxconverter-co…
jiafatom Sep 30, 2019
100032d
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Oct 7, 2019
5a58602
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Oct 7, 2019
0538560
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Oct 10, 2019
039ad65
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Oct 11, 2019
2ec25d6
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Oct 12, 2019
a3f90fa
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Oct 15, 2019
113b5f8
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Oct 21, 2019
090a2ba
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Oct 21, 2019
32aa76c
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Nov 13, 2019
3d26fbb
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Nov 18, 2019
20dd014
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Dec 5, 2019
4fc4369
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Dec 20, 2019
12e4afa
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Dec 26, 2019
490e617
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Dec 26, 2019
44feed4
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Dec 31, 2019
2e46efc
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Dec 31, 2019
2a2d56c
Merge branch 'master' of https://github.com/microsoft/onnxconverter-c…
jiafatom Jan 14, 2020
778a6b2
Support dynamic pads for Pad opset 11
jiafatom Jan 15, 2020
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
13 changes: 9 additions & 4 deletions onnxconverter_common/onnx_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ def apply_pad(scope, input_name, output_name, container, operator_name=None, mod
attrs['mode'] = mode

if container.target_opset < 11:
if isinstance(pads, str):
raise ValueError("Dynamic pad is not supported for opset < 11.")
if value is not None:
attrs['value'] = value
if container.target_opset < 2:
Expand All @@ -514,9 +516,12 @@ def apply_pad(scope, input_name, output_name, container, operator_name=None, mod
op_version = 2
else:
op_version = 11
pads_name = scope.get_unique_variable_name(name + '_pads')
container.add_initializer(pads_name, onnx_proto.TensorProto.INT64, [len(pads)], pads)
inputs.append(pads_name)
if isinstance(pads, str):
inputs.append(pads)
else:
pads_name = scope.get_unique_variable_name(name + '_pads')
container.add_initializer(pads_name, onnx_proto.TensorProto.INT64, [len(pads)], pads)
inputs.append(pads_name)
if value is not None:
value_name = scope.get_unique_variable_name(name + '_value')
container.add_initializer(value_name, onnx_type, [], [value])
Expand Down Expand Up @@ -743,7 +748,7 @@ def apply_slice(scope, input_name, output_name, container, starts, ends,
op_version = 10
else:
op_version = 11
inputs = [input_name]
inputs = input_name if isinstance(input_name, list) else [input_name]
starts_name = scope.get_unique_variable_name('starts')
ends_name = scope.get_unique_variable_name('ends')
container.add_initializer(starts_name, onnx_proto.TensorProto.INT64,
Expand Down