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/03 23:58:30 UTC
[GitHub] [incubator-tvm] kevinthesun opened a new pull request #4618:
[Topi]Allow empty tensor for reshape, tile and strided_slice
kevinthesun opened a new pull request #4618: [Topi]Allow empty tensor for reshape, tile and strided_slice
URL: https://github.com/apache/incubator-tvm/pull/4618
Some reshape, tile and strided_slice ops can generate empty tensor in some tensorflow models. This PR adds support in topi.
@zhiics @yongwww
----------------------------------------------------------------
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
[GitHub] [incubator-tvm] zhiics merged pull request #4618: [Topi]Allow empty
tensor for reshape, tile and strided_slice
Posted by GitBox <gi...@apache.org>.
zhiics merged pull request #4618: [Topi]Allow empty tensor for reshape, tile and strided_slice
URL: https://github.com/apache/incubator-tvm/pull/4618
----------------------------------------------------------------
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
[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request
#4618: [Topi]Allow empty tensor for reshape, tile and strided_slice
Posted by GitBox <gi...@apache.org>.
kevinthesun 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_r363120154
##########
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:
Merged.
----------------------------------------------------------------
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
[GitHub] [incubator-tvm] zhiics commented on a change in pull request #4618:
[Topi]Allow empty tensor for reshape, tile and strided_slice
Posted by GitBox <gi...@apache.org>.
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
[GitHub] [incubator-tvm] zhiics commented on issue #4618: [Topi]Allow empty
tensor for reshape, tile and strided_slice
Posted by GitBox <gi...@apache.org>.
zhiics commented on issue #4618: [Topi]Allow empty tensor for reshape, tile and strided_slice
URL: https://github.com/apache/incubator-tvm/pull/4618#issuecomment-570993142
Thanks @kevinthesun @yongwww
----------------------------------------------------------------
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