Skip to content

Commit

Permalink
[tflchef] Remove extype used for custom op
Browse files Browse the repository at this point in the history
This commit includes removing extype used for custom op because it is no longer necessary.

ONE-DCO-1.0-Signed-off-by: SeungHui Lee <[email protected]>
  • Loading branch information
Seunghui98 committed Nov 2, 2023
1 parent 7a102bc commit b01eac6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
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"

0 comments on commit b01eac6

Please sign in to comment.