Skip to content

[Unity][OP] Add arange op#14463

Merged
junrushao merged 1 commit intoapache:unityfrom
Hzfengsy:arange_op
Apr 4, 2023
Merged

[Unity][OP] Add arange op#14463
junrushao merged 1 commit intoapache:unityfrom
Hzfengsy:arange_op

Conversation

@Hzfengsy
Copy link
Member

@Hzfengsy Hzfengsy commented Apr 3, 2023

The current arange op in PyTorch is converted as constant at frontend, however, it does not work when the length is dynamic.

This PR adds arange op to relax, and use different rules when legalization:

  • If the length is fixed, we will convert it to constant.
  • If the length is dynamic, we use topi.arange to compute it.

@tvm-bot
Copy link
Collaborator

tvm-bot commented Apr 3, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

@Hzfengsy Hzfengsy force-pushed the arange_op branch 2 times, most recently from 64359c1 to 662930e Compare April 3, 2023 12:49
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

Copy link
Contributor

@slyubomirsky slyubomirsky left a comment

Choose a reason for hiding this comment

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

This all looks reasonable, thanks!

The current `arange` op in PyTorch is converted as constant at frontend,
however, it does not work when the length is dynamic.

This PR adds `arange` op to relax, and use different rules when legalization:

- If the length is fixed, we will convert it to constant.
- If the length is dynamic, we use `topi.arange` to compute it.
@junrushao junrushao merged commit 5c2058d into apache:unity Apr 4, 2023
@Hzfengsy Hzfengsy deleted the arange_op branch November 5, 2023 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants