You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/03/10 15:53:10 UTC

[GitHub] [tvm] mbrookhart commented on a change in pull request #7583: [Frontend][Tensorflow] dynamic support for StridedSlice

mbrookhart commented on a change in pull request #7583:
URL: https://github.com/apache/tvm/pull/7583#discussion_r591639980



##########
File path: python/tvm/relay/frontend/tensorflow.py
##########
@@ -44,6 +44,28 @@
 __all__ = ["from_tensorflow"]
 
 
+def check_symbolic_shape(shape):
+    return not all([isinstance(dim, (int, tvm.tir.IntImm)) for dim in shape])

Review comment:
       There's a utility to do this here: https://github.com/apache/tvm/blob/e561007f0c330e3d14c2bc8a3ef40fb741db9004/python/tvm/relay/ty.py#L29

##########
File path: python/tvm/relay/frontend/tensorflow.py
##########
@@ -44,6 +44,28 @@
 __all__ = ["from_tensorflow"]
 
 
+def check_symbolic_shape(shape):
+    return not all([isinstance(dim, (int, tvm.tir.IntImm)) for dim in shape])
+
+
+def list_shape_of(tensor, ndim):
+    shape_tensor = _op.shape_of(tensor)
+    return [
+        _op.strided_slice(shape_tensor, begin=[i], end=[i + 1], strides=[1]) for i in range(ndim)
+    ]

Review comment:
       I'm not sure I understand this utility, but perhaps `take` would be more appropriate than `strided_slice`?




----------------------------------------------------------------
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:
users@infra.apache.org