Skip to content

Commit

Permalink
[tflchef] Support TransposeConv activation (Samsung#11462)
Browse files Browse the repository at this point in the history
This will revise to support TransposeConv activation.

ONE-DCO-1.0-Signed-off-by: SaeHie Park <[email protected]>
  • Loading branch information
seanshpark authored Sep 4, 2023
1 parent b568b2c commit 2d39ef8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions compiler/tflchef/core/src/Op/TransposeConv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ flatbuffers::Offset<void> TransposeConvChef::value(flatbuffers::FlatBufferBuilde
options_builder.add_stride_h(operation.transpose_conv_options().stride_h());
options_builder.add_stride_w(operation.transpose_conv_options().stride_w());

// TODO remove calling has_activation
auto chef_activation = operation.transpose_conv_options().has_activation()
? operation.transpose_conv_options().activation()
: tflchef::NONE;
auto tflite_activation = as_tflite_activation(chef_activation);
options_builder.add_fused_activation_function(tflite_activation);

return options_builder.Finish().Union();
}

Expand Down
1 change: 1 addition & 0 deletions compiler/tflchef/proto/tflchef.proto
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ message TransposeConvOptions {
optional Padding padding = 1 [default = VALID];
optional int32 stride_w = 2 [default = 1];
optional int32 stride_h = 3 [default = 1];
optional Activation activation = 4 [default = NONE];
}

message ReverseSequenceOptions {
Expand Down
2 changes: 2 additions & 0 deletions compiler/tflchef/tflite/src/Op/TransposeConv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ tflchef::Operation *TFliteOpTransposeConv::build(const tflite::Operator *op, TFl
operation->set_type("TransposeConv");

auto op_options = operation->mutable_transpose_conv_options();
auto tflchef_activation = as_tflchef_activation(op_params->fused_activation_function());

op_options->set_stride_h(op_params->stride_h());
op_options->set_stride_w(op_params->stride_w());
op_options->set_padding(as_tflchef_padding(op_params->padding()));
op_options->set_activation(tflchef_activation);

return operation;
}
Expand Down

0 comments on commit 2d39ef8

Please sign in to comment.