From d8bf07d2a3b2a2eb63d9cb6bae7a21ac3fa073ce Mon Sep 17 00:00:00 2001 From: Gemfield Date: Mon, 25 Mar 2019 01:40:56 +0800 Subject: [PATCH] Enhance upsample operator to adapt onnx opset version 9 (#2840) --- python/tvm/relay/frontend/onnx.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/tvm/relay/frontend/onnx.py b/python/tvm/relay/frontend/onnx.py index d322da31fc197..e92aa203b401d 100644 --- a/python/tvm/relay/frontend/onnx.py +++ b/python/tvm/relay/frontend/onnx.py @@ -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':