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

Use coordinate_transformation_mode as default parameter (tf 2.0 will change it) #38

Merged
merged 19 commits into from
Dec 18, 2019
Merged
Changes from all commits
Commits
Show all changes
19 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
66cd6f9
test
jiafatom Dec 17, 2019
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
8 changes: 4 additions & 4 deletions onnxconverter_common/onnx_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def apply_reshape(scope, input_name, output_name, container, operator_name=None,
container.add_node('Reshape', input_name, output_name, op_version=5, name=name)


def apply_resize(scope, input_name, output_name, container, operator_name=None, mode='nearest', scales=None):
def apply_resize(scope, input_name, output_name, container, operator_name=None, mode='nearest', coordinate_transformation_mode='asymmetric', scales=None):
'''
:param mode: "nearest" or "linear"
:param scales: a float tensor for scaling (upsampling or downsampling) all input dimensions
Expand All @@ -590,7 +590,7 @@ def apply_resize(scope, input_name, output_name, container, operator_name=None,
roi = [0.0] * len(scales) + [1.0] * len(scales)
container.add_initializer(roi_tensor_name, onnx_proto.TensorProto.FLOAT, [2 * len(scales)], roi)
inputs.append(roi_tensor_name)
attrs['coordinate_transformation_mode'] = 'asymmetric'
attrs['coordinate_transformation_mode'] = coordinate_transformation_mode
if attrs['mode'] == 'nearest':
attrs['nearest_mode'] = 'floor'

Expand Down Expand Up @@ -806,7 +806,7 @@ def apply_transpose(scope, input_name, output_name, container, operator_name=Non
container.add_node('Transpose', input_name, output_name, name=name, perm=perm)


def apply_upsample(scope, input_name, output_name, container, operator_name=None, mode='nearest', scales=None):
def apply_upsample(scope, input_name, output_name, container, operator_name=None, mode='nearest', coordinate_transformation_mode='asymmetric', scales=None):
'''
:param mode: nearest or linear
:param scales: an integer list of scaling-up rate of all input dimensions
Expand Down Expand Up @@ -838,4 +838,4 @@ def apply_upsample(scope, input_name, output_name, container, operator_name=None
else:
# Upsample op is deprecated in ONNX opset 10
# We implement Upsample through Resize instead
apply_resize(scope, input_name, output_name, container, operator_name, mode, scales)
apply_resize(scope, input_name, output_name, container, operator_name, mode, coordinate_transformation_mode, scales)