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 2020/01/04 04:25:35 UTC
[GitHub] [incubator-tvm] zhiics commented on a change in pull request #4618:
[Topi]Allow empty tensor for reshape, tile and strided_slice
zhiics commented on a change in pull request #4618: [Topi]Allow empty tensor for reshape, tile and strided_slice
URL: https://github.com/apache/incubator-tvm/pull/4618#discussion_r363015325
##########
File path: topi/python/topi/util.py
##########
@@ -417,3 +417,25 @@ def make_idx(b, e, s, z, i):
(b - i) // tvm.abs(s),
(i - b) // s)
return tvm.if_then_else(tvm.expr.Or(bc, ec), 88, ss)
+
+
+def is_empty_shape(shape):
+ """Check whether an input shape has dimesion with size 0.
+
+ Parameter
+ ---------
+ shape : list of Expr
+ Input shape
+
+ Returns
+ -------
+ is_empty: bool
+ Whether input shape is empty or has dimesion with size 0.
+ """
+ is_empty = False
Review comment:
equivalent to the following (same for C++ code) ?
```python
for dim in shape:
if isinstance(dim, tvm.expr.IntImm):
if dim.value == 0:
return True
return False
```
----------------------------------------------------------------
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
With regards,
Apache Git Services