-
Notifications
You must be signed in to change notification settings - Fork 157
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
[tflchef] Use extype and custom_code type for custom operators #11785
Conversation
2959975
to
cf59238
Compare
cf59238
to
859196a
Compare
if ((operation.has_extype() && operation.extype() == "Custom") || | ||
(operation.has_type() && operation.type() == "Custom")) | ||
continue; |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
compiler/tflchef/core/src/OpChef.h
Outdated
static void CheckCustomOp(const tflchef::Operation operation, std::string op_type) | ||
{ | ||
if ((operation.has_extype() && operation.extype() == "Custom") || | ||
(operation.has_type() && operation.type() == "Custom")) | ||
{ | ||
assert(operation.has_custom_code()); | ||
assert(operation.custom_code() == op_type); | ||
} | ||
}; | ||
|
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.
I created a function here to avoid duplication.
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.
Q) Can you explain more about what you mean by avoid duplication
?
As you(@seanshpark ) advised, I rewrote the code. |
compiler/tflchef/core/src/OpChef.h
Outdated
@@ -45,4 +45,14 @@ struct OpChefFactory | |||
virtual std::unique_ptr<OpChef> create(const tflchef::Operation *operation) const = 0; | |||
}; | |||
|
|||
static void CheckCustomOp(const tflchef::Operation operation, std::string op_type) |
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.
plz do not use static
in header. there will be duplicate static functions across the callers.
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.
Could you advise me where it would be good...?
Please think of what the purpose of this function, and the scope of the functionality.
And looking in other global methods in Convert.h
, please follow existing snake_case convention.
And does CheckCustomOp
express the purpose of new method?
Naming is difficult and needs some experience, which may require try and error.
@Seunghui98 , this PR has multiple context of changes and title/description of this PR doesn't seem to explain the changes. |
f39a238
to
7fd0282
Compare
d5a6d2d
to
3fae109
Compare
This PR will be reflected after the previous PR. |
This commit includes replacing op type with custom_code if op_type is Custom or extype is Custom. ONE-DCO-1.0-Signed-off-by: SeungHui Lee <[email protected]>
3fae109
to
0e5f38e
Compare
customcode_set.insert(operation.type()); | ||
if ((operation.has_extype() && operation.extype() == "Custom") || operation.type() == "Custom") | ||
{ | ||
assert(operation.custom_code() != ""); |
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.
This one would be more readable.
assert(operation.custom_code() != ""); | |
assert(not operation.custom_code().empty()); |
3b99cd9
to
9e7ae17
Compare
93864d9
to
3a6ecd8
Compare
@seanshpark @mhs4670go |
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.
LGTM
3a6ecd8
to
c09ace9
Compare
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.
LGTM
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.
LGTM:)
This introduces extype and custom_code for custom operators.
ONE-DCO-1.0-Signed-off-by: SeungHui Lee [email protected]
Related Issue: #11741
Draft PR: #11750