forked from Samsung/ONE
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tflchef] Enable RELU_0_TO_1 (Samsung#12943)
This will enable to chef RELU_0_TO_1 Op. ONE-DCO-1.0-Signed-off-by: SaeHie Park <[email protected]>
- Loading branch information
1 parent
a9d3ee7
commit 60cb9d1
Showing
8 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "ReLU0To1.h" | ||
|
||
flatbuffers::Offset<void> ReLU0To1Chef::value(flatbuffers::FlatBufferBuilder &fbb) const | ||
{ | ||
return flatbuffers::Offset<void>(); | ||
} | ||
|
||
std::unique_ptr<OpChef> ReLU0To1ChefFactory::create(const tflchef::Operation *operation) const | ||
{ | ||
return std::unique_ptr<OpChef>{new ReLU0To1Chef{operation}}; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef __OP_RELU_0_TO_1_H__ | ||
#define __OP_RELU_0_TO_1_H__ | ||
|
||
#include "OpChef.h" | ||
|
||
class ReLU0To1Chef final : public OpChef | ||
{ | ||
public: | ||
explicit ReLU0To1Chef(const tflchef::Operation *operation) : _operation{operation} | ||
{ | ||
// DO NOTHING | ||
} | ||
|
||
public: | ||
tflite::BuiltinOperator code(void) const override { return tflite::BuiltinOperator_RELU_0_TO_1; } | ||
|
||
tflite::BuiltinOptions type(void) const override { return tflite::BuiltinOptions_NONE; } | ||
|
||
flatbuffers::Offset<void> value(flatbuffers::FlatBufferBuilder &fbb) const override; | ||
|
||
private: | ||
const tflchef::Operation *_operation; | ||
}; | ||
|
||
struct ReLU0To1ChefFactory final : public OpChefFactory | ||
{ | ||
std::unique_ptr<OpChef> create(const tflchef::Operation *operation) const override; | ||
}; | ||
|
||
#endif // __OP_RELU_0_TO_1_H__ |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "ReLU0To1.h" | ||
|
||
#include "Convert.h" | ||
|
||
namespace tflchef | ||
{ | ||
|
||
void TFliteOpReLU0To1::filler(const tflite::Operator *op, TFliteImport *import, | ||
tflchef::ModelRecipe *model_recipe) const | ||
{ | ||
// Nothing to do with filler | ||
} | ||
|
||
tflchef::Operation *TFliteOpReLU0To1::build(RecipeChefContext *ctx) const | ||
{ | ||
tflchef::Operation *operation = ctx->chefop; | ||
const tflite::Operator *op = ctx->tflop; | ||
|
||
operation->set_type("ReLU0To1"); | ||
|
||
return operation; | ||
} | ||
|
||
} // namespace tflchef |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef __TFLITE_OP_RELU_0_TO_1_H__ | ||
#define __TFLITE_OP_RELU_0_TO_1_H__ | ||
|
||
#include "TFliteOpChef.h" | ||
|
||
namespace tflchef | ||
{ | ||
|
||
/** | ||
* @brief tflchef operator builder for RELU_0_TO_1 | ||
*/ | ||
class TFliteOpReLU0To1 : public TFliteOpChef | ||
{ | ||
public: | ||
void filler(const tflite::Operator *op, TFliteImport *import, | ||
tflchef::ModelRecipe *model_recipe) const override; | ||
tflchef::Operation *build(RecipeChefContext *ctx) const override; | ||
}; | ||
|
||
} // namespace tflchef | ||
|
||
#endif // __TFLITE_OP_RELU_0_TO_1_H__ |
This file contains 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
This file contains 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