Skip to content

Commit

Permalink
Enhance upsample operator to adapt onnx opset version 9 (apache#2840)
Browse files Browse the repository at this point in the history
  • Loading branch information
gemfield authored and wweic committed Mar 24, 2019
1 parent f5a2337 commit d577ddf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/tvm/relay/frontend/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,13 @@ class Upsample(OnnxOpConverter):
"""

@classmethod
def _impl_v7(cls, inputs, attr, params):
def _impl_v9(cls, inputs, attr, params):
scales = attr.get('scales')
if not scales:
#Here we are going to higher OPSET version.
assert len(inputs) == 2, "Upsample op take 2 inputs, {} given".format(len(inputs))
scales = params[inputs[1].name_hint].asnumpy()
inputs = inputs[:1]
assert len(scales) == 4 and scales[0] == 1.0 and scales[1] == 1.0 and scales[2] == scales[3]
mode = attr.get('mode')
if mode == b'nearest':
Expand Down

0 comments on commit d577ddf

Please sign in to comment.