jtuyls opened a new pull request #8989:
URL: https://github.com/apache/tvm/pull/8989


   While experimenting with `dyn.strided_slice` I noticed that some of the 
DynamicToStatic pass tests are not testing dynamic expressions. For example, 
the created strided_slice function here 
https://github.com/apache/tvm/blob/02f885aacde5739c060507afa0b534019d5439cc/tests/python/relay/test_pass_dynamic_to_static.py#L435
   looks like this: 
   ```
   fn (%x: Tensor[(1, 3, 10, 10), float32]) {
     strided_slice(%x, begin=[0, 0, 0, 0], end=[1, 3, 10, 10], strides=[1, 1, 
1, 1], axes=None)
   }
   ```
   which I think doesn't test the DynamicToStatic pass being executed on this 
expression. With the small changes in this PR, the above function looks like 
this:
   ```
   fn (%x: Tensor[(1, 3, 10, 10), float32], %begin: Tensor[(4), int64], %end: 
Tensor[(4), int64], %strides: Tensor[(4), int64]) {
     %0 = cast_like(0, %begin);
     %1 = shape_of(%x, dtype="int32");
     %2 = cast_like(%1, %begin);
     %3 = slice_like(%2, %begin, axes=None);
     %4 = less(%begin, %0);
     %5 = add(%begin, %3);
     %6 = where(%4, %5, %begin);
     %7 = greater_equal(%6, %3);
     %8 = where(%7, %3, %6);
     dyn.strided_slice(%x, %8, %end, %strides, begin=None, end=None, 
strides=None, axes=None)
   }
   ```
   which I think is a better test for the DynamicToStatic pass.
   
   Similarly, tests for topk, resize2d, upsampling, upsampling3d and pad have 
been adjusted.
   
   @mbrookhart Could you help with reviewing this PR?


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


Reply via email to