You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "yongwww (via GitHub)" <gi...@apache.org> on 2023/04/11 19:49:23 UTC

[GitHub] [tvm] yongwww commented on a diff in pull request #14548: [Unity][Op] Dynamic Strided Slice

yongwww commented on code in PR #14548:
URL: https://github.com/apache/tvm/pull/14548#discussion_r1163256040


##########
python/tvm/relax/transform/legalize_ops/index.py:
##########
@@ -59,3 +60,39 @@ def _strided_slice(bb: BlockBuilder, call: Call) -> Expr:
         call.attrs.axes,
         slice_mode="end",
     )
+
+
+@register_legalize("relax.dynamic_strided_slice")
+def _dynamic_strided_slice(bb: BlockBuilder, call: Call) -> Expr:
+    # 1. Insert shape function
+    output_shape = bb.normalize(
+        bb.call_te(
+            topi.shape_func_dynamic_strided_slice,

Review Comment:
   I agree that "partially-static" cases are common. However, writing TIR manually might make it more challenging for contributors to develop data-dependent ops. Simplifying the shape function implementation could be beneficial. I think several ops like reshape or max_pool2d could be used as partially-dynamic, such as allowing dynamic or partially-dynamic strides in max_pool even I haven't encountered the real-world use cases.



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org