icemelon9 commented on a change in pull request #5955:
URL: https://github.com/apache/incubator-tvm/pull/5955#discussion_r457731237
##########
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:
I see. Sorry for missing the details here.
##########
File path: tests/python/relay/test_any.py
##########
@@ -816,6 +816,55 @@ def test_mixed_input_type():
assert result.asnumpy().shape == ref_out_shape, \
"Shape mismatch: expect %s but got %s." % (str(ref_out_shape),
str(result.asnumpy().shape))
+def verify_any_crop_and_resize(data_shape, boxes_shape, box_indices_shape,
crop_size,
+ static_boxes, static_box_indices_shape,
ref_out_shape):
+ mod = tvm.IRModule()
+ dtype = "float32"
+ indices_dtype = "int32"
+ data = relay.var('data', shape=data_shape, dtype=dtype)
+ boxes = relay.var('boxes', shape=boxes_shape, dtype=dtype)
+ box_indices = relay.var('box_indices', shape=box_indices_shape,
dtype=indices_dtype)
+ y = relay.image.crop_and_resize(data, boxes, box_indices, crop_size,
'NHWC')
Review comment:
Could you add test case for "NCHW" as well?
----------------------------------------------------------------
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]