-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Relay] Alter Op Layout #2150
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
Merged
Merged
[Relay] Alter Op Layout #2150
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8a26c94
[RELAY] Finish alter op pass
merrymercy f55b89e
[RELAY] AlterOpLayout Pass
merrymercy 7972796
fix broadcast operators
merrymercy 627f568
fix broadcast operators
merrymercy d918875
fix broadcast operators
merrymercy dc098ca
Support concatenate
merrymercy 70ac9d3
address comments
merrymercy 1f10fcd
address comments
merrymercy e9cf2bb
add comments
merrymercy 8849f9a
rebase
merrymercy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule HalideIR
updated
3 files
| +3 −1 | src/arithmetic/Simplify.cpp | |
| +15 −6 | src/tvm/node/container.h | |
| +1 −0 | src/tvm/node/node.h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| """ TVM Attribute module, which is mainly used for defining attributes of operators""" | ||
| from ._ffi.node import NodeBase, register_node as _register_tvm_node | ||
| from ._ffi.function import _init_api | ||
| from . import _api_internal | ||
|
|
||
|
|
||
| @_register_tvm_node | ||
| class Attrs(NodeBase): | ||
| """Attribute node, which is mainly use for defining attributes of relay operators. | ||
|
|
||
| Used by function registered in python side, such as compute, schedule and alter_layout. | ||
| Attrs is passed as the first argument to these functions. | ||
| """ | ||
| def list_field_info(self): | ||
| """ Get fields information | ||
|
|
||
| Returns | ||
| ------- | ||
| infos: list of AttrFieldInfo | ||
| List of field information | ||
| """ | ||
| return _api_internal._AttrsListFieldInfo(self) | ||
|
|
||
| def keys(self): | ||
| """Get list of names in the attribute. | ||
|
|
||
| Returns | ||
| ------- | ||
| keys : list of str | ||
| List of keys | ||
| """ | ||
| fields = self.list_field_info() | ||
| for field in fields: | ||
| yield field.name | ||
|
|
||
| def __getitem__(self, item): | ||
| return self.__getattr__(item) | ||
|
|
||
|
|
||
| _init_api("tvm.attrs") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| """The attributes node used for Relay operators""" | ||
|
|
||
| from ...attrs import Attrs | ||
| from ..base import register_relay_attr_node | ||
|
|
||
| @register_relay_attr_node | ||
| class Conv2DAttrs(Attrs): | ||
| """Attribute of a Convolution Operator""" | ||
| pass | ||
|
|
||
| @register_relay_attr_node | ||
| class GlobalPool2DAttrs(Attrs): | ||
| """Attribute of a Global 2D Pooling Operator""" | ||
| pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we also need a correct layout function for concatenate?
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.
No. For concatenate, all its inputs will be transformed to old layouts. This is the default fallback case.
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.
is it possible for concat to propagate layout?
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes. We should add it