CircleSpin commented on a change in pull request #9265:
URL: https://github.com/apache/tvm/pull/9265#discussion_r728242091
##########
File path: python/tvm/relay/frontend/onnx.py
##########
@@ -2697,6 +2697,40 @@ def _impl_v10(cls, inputs, attr, params):
@classmethod
def _impl_v11(cls, inputs, attr, params):
+ scale = inputs[2]
+ scale_shape = infer_shape(scale)
+ if len(inputs) == 4:
+ assert (
+ len(scale_shape) == 0 or scale_shape[0] == 0
+ ), "One of scale or size should be passed, not both."
+ size = inputs[3]
+ else:
+ assert len(scale_shape) != 0, "One of scale or size should be
passed."
+ size = _op.cast(shape_of(inputs[0]),
infer_type(scale).checked_type.dtype) * scale
+ return cls.v11_13_common(inputs, size, attr, params)
+
+ @classmethod
+ def _impl_v13(cls, inputs, attr, params):
+ scale = inputs[2]
+ size = inputs[3]
+ if size is not None:
+ assert scale is None, "One of scale or size should be passed, not
both."
+ else:
+ scale_type = infer_type(scale)
+ scale_shape = scale_type.checked_type.shape
+ scale_dtype = scale_type.checked_type.dtype
+ assert len(scale_shape) != 0, "One of scale or size should be
passed."
+ size = _op.cast(shape_of(inputs[0]), scale_dtype) * scale
+
+ return cls.v11_13_common(inputs, size, attr, params)
+
+ @classmethod
+ def v11_13_common(cls, inputs, size, attr, params):
+ """
+ Resize v11 and Resize v13 are identical except in how
Review comment:
Hi emijiayw, Thanks for your feedback! Resize v13 is specified for
clarity since just resize could be misleading. :)
##########
File path: python/tvm/relay/frontend/onnx.py
##########
@@ -2697,6 +2697,40 @@ def _impl_v10(cls, inputs, attr, params):
@classmethod
def _impl_v11(cls, inputs, attr, params):
+ scale = inputs[2]
+ scale_shape = infer_shape(scale)
+ if len(inputs) == 4:
+ assert (
+ len(scale_shape) == 0 or scale_shape[0] == 0
+ ), "One of scale or size should be passed, not both."
+ size = inputs[3]
+ else:
+ assert len(scale_shape) != 0, "One of scale or size should be
passed."
+ size = _op.cast(shape_of(inputs[0]),
infer_type(scale).checked_type.dtype) * scale
+ return cls.v11_13_common(inputs, size, attr, params)
+
+ @classmethod
+ def _impl_v13(cls, inputs, attr, params):
+ scale = inputs[2]
+ size = inputs[3]
+ if size is not None:
+ assert scale is None, "One of scale or size should be passed, not
both."
Review comment:
both scale and size are singular (there is only one of them) and adding
an 's' makes them plural. It's only one dog or cat, not dogs or cats :dog:
:cat2: vs :dog: :dog: :dog: :cat2: :cat2: :cat2:
##########
File path: python/tvm/relay/frontend/onnx.py
##########
@@ -2697,6 +2697,40 @@ def _impl_v10(cls, inputs, attr, params):
@classmethod
def _impl_v11(cls, inputs, attr, params):
+ scale = inputs[2]
+ scale_shape = infer_shape(scale)
+ if len(inputs) == 4:
+ assert (
+ len(scale_shape) == 0 or scale_shape[0] == 0
+ ), "One of scale or size should be passed, not both."
+ size = inputs[3]
+ else:
+ assert len(scale_shape) != 0, "One of scale or size should be
passed."
Review comment:
Same as above!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]