Commit 6b2590e3 by Gemfield Committed by Tianqi Chen

Enhance upsample operator to adapt onnx opset version 9 (#2840)

parent 2df3364b
......@@ -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':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment