lsy643 commented on a change in pull request #5955:
URL: https://github.com/apache/incubator-tvm/pull/5955#discussion_r456989467



##########
File path: python/tvm/relay/op/image/_image.py
##########
@@ -64,6 +67,22 @@ def compute_crop_and_resize(attrs, inputs, out_type):
 
 reg.register_injective_schedule("image.crop_and_resize")
 
+@script
+def _crop_and_resize_func(image_shape, boxes_shape, crop_size):
+    out = output_tensor((4,), "int64")
+    out[0] = boxes_shape[0]
+    out[1] = int64(crop_size[0])
+    out[2] = int64(crop_size[1])
+    out[3] = image_shape[3]
+
+    return out
+
[email protected]_shape_func("image.crop_and_resize", False)
+def crop_and_resize_func(attrs, inputs, _):
+    crop_size = get_const_tuple(attrs.crop_size)

Review comment:
       @icemelon9 Sorry for the late reply. And I think that the output layout 
has already been considered in the `_crop_and_resize_func `, since 
`height_axis`, `width_axis` and  `channel_axis` are used to indicate the 
purpose of each axis. No matter layout is `NCHW` or `NHWC`, which means 
`channel_axis=1` or `channel_axis=3`, the channel index of the output shape is 
get by `out[channel_axis] = image_shape[channel_axis]`. Therefore the output 
layout is consistent with the input layout.




----------------------------------------------------------------
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]


Reply via email to