Skip to content
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

Merged
merged 6 commits into from
Jan 6, 2020

Conversation

kevinthesun
Copy link
Contributor

@kevinthesun kevinthesun commented Jan 3, 2020

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

is_empty: bool
Whether input shape is empty or has dimesion with size 0.
"""
is_empty = False
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged.

Copy link
Member

@yongwww yongwww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhiics zhiics merged commit 8e2f229 into apache:master Jan 6, 2020
@zhiics
Copy link
Member

zhiics commented Jan 6, 2020

Thanks @kevinthesun @yongwww

alexwong pushed a commit to alexwong/tvm that referenced this pull request Feb 26, 2020
…4618)

* Support empty tensor

* Fix schedule

* Refactor

* Minor fix

* Fix pylint

* Merge cpp and python is_empty_shape
alexwong pushed a commit to alexwong/tvm that referenced this pull request Feb 28, 2020
…4618)

* Support empty tensor

* Fix schedule

* Refactor

* Minor fix

* Fix pylint

* Merge cpp and python is_empty_shape
zhiics pushed a commit to neo-ai/tvm that referenced this pull request Mar 2, 2020
…4618)

* Support empty tensor

* Fix schedule

* Refactor

* Minor fix

* Fix pylint

* Merge cpp and python is_empty_shape
@kevinthesun kevinthesun deleted the EmptyTensor branch March 23, 2020 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants