-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Topi]Allow empty tensor for reshape, tile and strided_slice #4618
Conversation
topi/python/topi/util.py
Outdated
is_empty: bool | ||
Whether input shape is empty or has dimesion with size 0. | ||
""" | ||
is_empty = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
equivalent to the following (same for C++ code) ?
for dim in shape:
if isinstance(dim, tvm.expr.IntImm):
if dim.value == 0:
return True
return False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @kevinthesun @yongwww |
…4618) * Support empty tensor * Fix schedule * Refactor * Minor fix * Fix pylint * Merge cpp and python is_empty_shape
…4618) * Support empty tensor * Fix schedule * Refactor * Minor fix * Fix pylint * Merge cpp and python is_empty_shape
…4618) * Support empty tensor * Fix schedule * Refactor * Minor fix * Fix pylint * Merge cpp and python is_empty_shape
Some reshape, tile and strided_slice ops can generate empty tensor(tensor shape such as (4, 0, 2)) in some tensorflow models. This PR adds support in topi.
@zhiics @yongwww