-
Notifications
You must be signed in to change notification settings - Fork 0
Sym pass2 #2
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
Open
cortexlfj
wants to merge
12
commits into
master
Choose a base branch
from
sym_pass2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Sym pass2 #2
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
abc26e7
[symbol_structure]: add mir op_class, add mir symbol_pass
cortexlfj 47d6062
[mir]: fix last commit
cortexlfj 2e2cfde
[mir]: opclass compatible
cortexlfj ab36f5f
[mir]: opclass opfunc, more op
cortexlfj d036f17
[mir]: add inferpass(with params)
cortexlfj 4cde590
[mir]: opclass redefine names, op compulsory attrs check
cortexlfj 7fcde4e
[mir]: testing infer_pass, fix some opclass issue
cortexlfj 2843c2f
[mir]: WithParameters not inherit from Symbol
cortexlfj 1b83b76
[mir]: Pass for resnet18
cortexlfj 8e7a44d
[mir]: rename transformer
cortexlfj 101d414
[mir]: spliter/merger trace load
cortexlfj 74aa4f0
[mir]: remove dataclass of SymbolBridge
cortexlfj 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
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,35 @@ | ||
| import typing | ||
|
|
||
| from mrt.common.utils import * | ||
| from mrt.common.types import * | ||
|
|
||
| from . import opns, opclass, optype | ||
| from . import symbol | ||
|
|
||
| #from mrt.mir.mhsymbol import MultiHeadSymbol, Graph | ||
| class MultiHeadSymbol(dict): | ||
| """ { "main": F(X) } """ | ||
| origin: typing.Optional[symbol.Symbol] = None | ||
|
|
||
| @classmethod | ||
| def from_symbol(cls, symbol: symbol.Symbol, name: str = "main"): | ||
| return MultiHeadSymbol({ name: symbol }) | ||
|
|
||
| def as_tuple(self) -> typing.Tuple[typing.List[str], symbol.Symbol]: | ||
| # args = list(self.values()) | ||
| # sym_type = type(args[0]) if args else Symbol | ||
| mhs = self.origin or optype.infer_single(opclass.MRT_OP_MAP[opns.TUPLE](*list(self.values()))) | ||
| return list(self.keys()), mhs | ||
|
|
||
| @classmethod | ||
| def from_tuple(cls, tuple_names, symbol): | ||
| assert symbol.is_op(opns.TUPLE), symbol | ||
| mhs = cls(zip(tuple_names, symbol.args)) | ||
| mhs.origin = symbol | ||
| return mhs | ||
|
|
||
| Graph = typing.Union[symbol.Symbol, MultiHeadSymbol] | ||
| """ Notice that Symbol and MultiHeadSymbol can both | ||
| be regarded as a model Graph. | ||
| """ | ||
|
|
||
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.
MultiHeadSymbol should inherit from
Symbolclass, and theGraphis exactlyMultiHeadSymbol.