zhiics commented on a change in pull request #5983:
URL: https://github.com/apache/incubator-tvm/pull/5983#discussion_r450395718
##########
File path: python/tvm/relay/op/dyn/_transform.py
##########
@@ -81,3 +84,23 @@ def _reshape_shape_func_input_data(data, newshape, ndim):
@_reg.register_shape_func("dyn.reshape", True)
def dynamic_reshape_shape_func(attrs, inputs, out_ndims):
return [_reshape_shape_func_input_data(*inputs, out_ndims[0])]
+
+
+@script
+def _tile_shape_func(data, reps, ndim):
+ out = output_tensor((ndim,), "int64")
+
+ for i in const_range(ndim):
+ out[i] = data.shape[i] * int64(reps[i])
+ return out
+
+
+@_reg.register_shape_func("dyn.tile", True)
+def tile_shape_func(attrs, inputs, _):
+ """
+ Shape function for tile op.
+ """
+ ndim = len(inputs[0].shape)
+ rdim = inputs[1].shape[0].value
+ assert ndim == rdim, "tile data and reps ranks don't match"
Review comment:
Last question, I notice that the shape_func here is somehow different
from the previous impl
https://github.com/apache/incubator-tvm/blob/151f3f5a00b5b2e2a369b9169dc8cda02e87e82a/python/tvm/relay/op/_transform.py#L609
is it expected?
----------------------------------------------------------------
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]