Skip to content
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] Remove extype used for custom op #11868

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions compiler/tflchef/core/src/ModelChef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ gather_builtincode_map(const ::tflchef::ModelRecipe &model_recipe)

for (const auto &operation : model_recipe.operation())
{
if (operation.type() == "Custom" || (operation.has_extype() && operation.extype() == "Custom"))
if (operation.type() == "Custom")
continue;

auto op_chef = op_chef_registry().lookup(operation.type()).create(&operation);
Expand All @@ -157,8 +157,7 @@ gather_builtincode_map(const ::tflchef::ModelRecipe &model_recipe)
const auto &graph = model_recipe.graph(g);
for (const auto &operation : graph.operation())
{
if (operation.type() == "Custom" ||
(operation.has_extype() && operation.extype() == "Custom"))
if (operation.type() == "Custom")
continue;

auto op_chef = op_chef_registry().lookup(operation.type()).create(&operation);
Expand All @@ -178,7 +177,7 @@ std::set<std::string> gather_customcode_set(const ::tflchef::ModelRecipe &model_
std::set<std::string> customcode_set;
for (const auto &operation : model_recipe.operation())
{
if (operation.type() == "Custom" || (operation.has_extype() && operation.extype() == "Custom"))
if (operation.type() == "Custom")
{
assert(not operation.custom_code().empty());
customcode_set.insert(operation.custom_code());
Expand All @@ -191,8 +190,7 @@ std::set<std::string> gather_customcode_set(const ::tflchef::ModelRecipe &model_
const auto &graph = model_recipe.graph(g);
for (const auto &operation : graph.operation())
{
if (operation.type() == "Custom" ||
(operation.has_extype() && operation.extype() == "Custom"))
if (operation.type() == "Custom")
{
assert(not operation.custom_code().empty());
customcode_set.insert(operation.custom_code());
Expand Down
2 changes: 1 addition & 1 deletion compiler/tflchef/core/src/OpUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

void check_custom_op_value(const tflchef::Operation operation, std::string op_type)
{
if (operation.type() == "Custom" || (operation.has_extype() && operation.extype() == "Custom"))
if (operation.type() == "Custom")
{
assert(operation.custom_code() == op_type);
}
Expand Down
1 change: 0 additions & 1 deletion compiler/tflchef/proto/tflchef.proto
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@ message Operation {
optional int32 version = 4 [default = 1];
optional string custom_code = 5;

optional string extype = 99;
optional Conv2DOptions conv2d_options = 100;
optional Pool2DOptions averagepool2d_options = 101;
optional ConcatenationOptions concatenation_options = 102;
Expand Down
3 changes: 1 addition & 2 deletions compiler/tflchef/tests/custom_erf/test.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ operand {
shape { dim: 1 dim: 3 dim: 3 dim: 2 }
}
operation {
type: "Erf"
type: "Custom"
input: "ifm"
output: "ofm"
custom_code: "Erf"
extype: "Custom"
}
input: "ifm"
output: "ofm"