wjliu1998 commented on a change in pull request #6468:
URL: https://github.com/apache/incubator-tvm/pull/6468#discussion_r487824170
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1230,6 +1230,45 @@ def _impl(inputs, input_types):
return _impl
+def _pixel_shuffle(prelude):
+ def _impl(inputs, input_types):
+ data = inputs[0]
+ upscale_factor = inputs[1]
+ upscale_squared = upscale_factor * upscale_factor
+ b, c, h, w = _infer_shape(data)
+ assert c % upscale_squared == 0, \
+ "input channel should be divisible by square of upscale_factor"
+
+ import torch
+ if isinstance(data, _expr.Expr):
+ ndims = len(_infer_shape(data, prelude.mod))
+ elif isinstance(data, list):
+ ndims = data
+ elif isinstance(data, (torch.Tensor, np.ndarray)):
+ ndims = _infer_shape(data)
+ else:
+ msg = "Data type %s could not be parsed in transpose op" %
(type(data))
+ raise AssertionError(msg)
+
+ if isinstance(data, tvm.runtime.NDArray):
+ ndims = len(_infer_shape(data))
Review comment:
Thank you for pointing out that. It seems `ndims =
len(_infer_shape(data, prelude.mod))` is enough
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]