masahi commented on a change in pull request #6468:
URL: https://github.com/apache/incubator-tvm/pull/6468#discussion_r487684233
##########
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:
It seems you copy pasted the above code from `_transpose()`. That one is
a legacy code we don't want to repeat. Please leave only what is necessary.
----------------------------------------------------------------
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]