sunggg commented on code in PR #14324:
URL: https://github.com/apache/tvm/pull/14324#discussion_r1140504591
##########
tests/python/relax/test_op_index.py:
##########
@@ -376,22 +409,22 @@ def test_strided_slice_infer_struct_info_shape_symbolic():
_check_inference(
bb,
relax.op.strided_slice(x0, axes=[0], begin=[1], end=[3]),
- relax.TensorStructInfo((2, n), "float32"),
+ relax.TensorStructInfo((tir.min(3, m) - tir.min(1, m) + 1 - 1, n),
"float32"),
Review Comment:
I think the problem is depending on what `m` is given at runtime, the output
shape can be different due to the boundary condition.
For example, when I play around with this in numpy:
```
>>> a= np.random.rand(4)
>>> a[1:3].shape
(2,)
>>> b=np.random.rand(3)
>>> b[1:3].shape
(2,)
>>> c=np.random.rand(2)
>>> c[1:3].shape
(1,)
>>> d=np.random.rand(1)
>>> d[1:3].shape
(0,)
```
So, I think it might be inevitable to have symbolic shape in this case and
insert the runtime check (e.g., detecting zero like `d`).
--
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]