jwfromm commented on a change in pull request #9475:
URL: https://github.com/apache/tvm/pull/9475#discussion_r748641288
##########
File path: src/relay/transforms/pattern_utils.h
##########
@@ -450,6 +450,23 @@ static inline Array<Integer> ToVector(const
runtime::NDArray& array) {
return out;
}
+/*!
+ * \brief Convert a NDArray with type int or float to Array<FloatImm>.
+ * \param array Input NDArray
+ * \return Converted Array.
+ */
+static inline Array<FloatImm> ToFloatVector(const runtime::NDArray& array) {
Review comment:
Just curious, why was this needed? I dont see how it interacts with
resize.
##########
File path: python/tvm/relay/op/image/image.py
##########
@@ -125,6 +143,9 @@ def resize2d(
size: Tuple of Int or Expr
The out size to which the image will be resized.
+ roi: Tuple of Float or Expr
+ The region of interest for tf_crop_and_resize.
Review comment:
I think itd be helpful to describe the expected shape of ROI since
[2*dims] isnt obvious and is a hard requirement. Just adding it to the relay
parameter comments should be enough.
##########
File path: python/tvm/relay/frontend/onnx.py
##########
@@ -2675,27 +2684,55 @@ def v11_13_common(cls, inputs, size, attr, params):
nearest_mode = attr.get("nearest_mode",
b"round_prefer_floor").decode("ascii")
alpha = attr.get("cubic_coeff_a", -0.75)
exclude = attr.get("exclude_outside", 0)
+ extrapolation_value = attr.get("extrapolation_value", 0.0)
out_size = fold_constant(_op.strided_slice(size, [2], [4]))
out = None
if ndims == 3:
out_size = fold_constant(_op.strided_slice(size, [2], [3]))
out = _op.image.resize1d(
- inputs[0], out_size, "NCW", method, coord_trans, nearest_mode,
alpha, exclude
+ inputs[0],
+ out_size,
+ roi,
+ "NCW",
+ method,
+ coord_trans,
+ nearest_mode,
+ alpha,
+ exclude,
+ extrapolation_value,
)
elif ndims == 4:
out_size = fold_constant(_op.strided_slice(size, [2], [4]))
out = _op.image.resize2d(
- inputs[0], out_size, "NCHW", method, coord_trans,
nearest_mode, alpha, exclude
+ inputs[0],
+ out_size,
+ roi,
+ "NCHW",
+ method,
+ coord_trans,
+ nearest_mode,
+ alpha,
+ exclude,
+ extrapolation_value,
)
elif ndims == 5:
out_size = fold_constant(_op.strided_slice(size, [2], [5]))
out = _op.image.resize3d(
- inputs[0], out_size, "NCDHW", method, coord_trans,
nearest_mode, alpha, exclude
+ inputs[0],
+ out_size,
+ roi,
+ "NCDHW",
+ method,
+ coord_trans,
+ nearest_mode,
+ alpha,
+ exclude,
+ extrapolation_value,
)
else:
raise NotImplementedError("Resize only supports 3, 4, or 5 dims")
-
+ print(out)
Review comment:
forgot to remove a print.
##########
File path: tests/python/frontend/onnx/test_forward.py
##########
@@ -4955,7 +4955,7 @@ def verify_eyelike(indata):
"test_reduce_sum_keepdims_random",
"test_reduce_sum_negative_axes_keepdims_example",
"test_reduce_sum_negative_axes_keepdims_random",
- "test_resize_tf_crop_and_resize",
+ # "test_resize_tf_crop_and_resize",
Review comment:
We should delete this instead of comment right?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]