[Relay][Pass] SimplifyCastLike/Cast and ConcretizeFullLikeRewrite rewrites for SimplifyExpr#7827
Merged
comaniac merged 4 commits intoapache:mainfrom Apr 14, 2021
Merged
Conversation
comaniac
requested changes
Apr 12, 2021
| /*! | ||
| * \brief SimplifyCast matches the pattern of cast data to the same dtype. | ||
| */ | ||
| class SimplifyCast : public DFPatternRewrite { |
Contributor
There was a problem hiding this comment.
Seems like these two patterns be merged to one?
pattern_ = IsOp("cast_like")({data_pat_, like_pat_}) || IsOp("cast")({data_pat_});
And both patterns can use like_ty = pre->checked_type().as<TensorTypeNode>();.
comaniac
reviewed
Apr 13, 2021
| } | ||
| }); | ||
| pass_seqs.push_back(transform::EliminateCommonSubexpr(fskip)); | ||
| pass_seqs.push_back(transform::InferType()); |
Contributor
There was a problem hiding this comment.
Do we really need this? InferType is already in the requirement of SimplifyExpr. Other existing patterns also refer to checked_type_ so it should be fine.
Contributor
Author
There was a problem hiding this comment.
Emmm... I dont know why Ci fails, just try it
Contributor
There was a problem hiding this comment.
From the CI it does look like the type is missing. Since InferType is executed before and after SimplifyExpr, one possibility is your data is already mutated by previous patterns in this pass and that callback didn't manually specify the type.
Contributor
trevor-m
pushed a commit
to trevor-m/tvm
that referenced
this pull request
May 6, 2021
…rites for SimplifyExpr (apache#7827)
trevor-m
pushed a commit
to trevor-m/tvm
that referenced
this pull request
May 6, 2021
…rites for SimplifyExpr (apache#7827)
trevor-m
pushed a commit
to trevor-m/tvm
that referenced
this pull request
May 6, 2021
…rites for SimplifyExpr (apache#7827)
trevor-m
pushed a commit
to neo-ai/tvm
that referenced
this pull request
May 11, 2021
…rites for SimplifyExpr (apache#7827)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ConcretizeFullLikeRewrite:full_like->fullwhen known shapeSimplifyCastLike/Cast:cast(data, dtype)orcast_like(data, dtype_like)->data, when the input and output have the same dtype@yzhliu @comaniac @altanh