diff options
author | Chunseok Lee <chunseok.lee@samsung.com> | 2022-04-15 19:15:11 +0900 |
---|---|---|
committer | Chunseok Lee <chunseok.lee@samsung.com> | 2022-04-15 19:15:11 +0900 |
commit | 3ad689f0803519e343c36d5700646e86059df961 (patch) | |
tree | 862346c401a5577518fa7f042532aa931b53aa0e /compiler/tflite2circle/src/BuildBuiltinOptions | |
parent | ac6e4dd7b480e83b586ef533d7b29a8a97eb48fe (diff) | |
download | nnfw-3ad689f0803519e343c36d5700646e86059df961.tar.gz nnfw-3ad689f0803519e343c36d5700646e86059df961.tar.bz2 nnfw-3ad689f0803519e343c36d5700646e86059df961.zip |
Imported Upstream version 1.20.0upstream/1.20.0submit/tizen/20220415.103159
Diffstat (limited to 'compiler/tflite2circle/src/BuildBuiltinOptions')
3 files changed, 73 insertions, 0 deletions
diff --git a/compiler/tflite2circle/src/BuildBuiltinOptions/FullyConnectedOptions.cpp b/compiler/tflite2circle/src/BuildBuiltinOptions/FullyConnectedOptions.cpp index 2619b73eb..27410012d 100644 --- a/compiler/tflite2circle/src/BuildBuiltinOptions/FullyConnectedOptions.cpp +++ b/compiler/tflite2circle/src/BuildBuiltinOptions/FullyConnectedOptions.cpp @@ -37,6 +37,7 @@ build_circle_FullyConnectedOptions(flatbuffers::FlatBufferBuilder &fb, const tfl else if (tflite_weight_format == tflite::FullyConnectedOptionsWeightsFormat_SHUFFLED4x16INT8) builtin_options_builder.add_weights_format( circle::FullyConnectedOptionsWeightsFormat_SHUFFLED4x16INT8); + builtin_options_builder.add_keep_num_dims(tflite_builtin_options->keep_num_dims()); return builtin_options_builder.Finish(); } diff --git a/compiler/tflite2circle/src/BuildBuiltinOptions/SVDFOptions.cpp b/compiler/tflite2circle/src/BuildBuiltinOptions/SVDFOptions.cpp new file mode 100644 index 000000000..e23738a69 --- /dev/null +++ b/compiler/tflite2circle/src/BuildBuiltinOptions/SVDFOptions.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2021 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 "SVDFOptions.h" +#include "DataLookup.h" + +#include <cassert> + +namespace tflite2circle +{ + +flatbuffers::Offset<circle::SVDFOptions> +build_circle_SVDFOptions(flatbuffers::FlatBufferBuilder &fb, const tflite::Operator *op) +{ + auto *tflite_builtin_options = op->builtin_options_as_SVDFOptions(); + assert(tflite_builtin_options); + + circle::SVDFOptionsBuilder builtin_options_builder{fb}; + builtin_options_builder.add_rank(tflite_builtin_options->rank()); + builtin_options_builder.add_asymmetric_quantize_inputs( + tflite_builtin_options->asymmetric_quantize_inputs()); + builtin_options_builder.add_fused_activation_function( + get_circle_activation_function_type(tflite_builtin_options->fused_activation_function())); + + return builtin_options_builder.Finish(); +} + +} // namespace tflite2circle diff --git a/compiler/tflite2circle/src/BuildBuiltinOptions/SVDFOptions.h b/compiler/tflite2circle/src/BuildBuiltinOptions/SVDFOptions.h new file mode 100644 index 000000000..2ddbd3911 --- /dev/null +++ b/compiler/tflite2circle/src/BuildBuiltinOptions/SVDFOptions.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 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 __BBO_SVDF_OPTIONS_H__ +#define __BBO_SVDF_OPTIONS_H__ + +#include <mio/tflite/schema_generated.h> +#include <mio/circle/schema_generated.h> + +namespace tflite2circle +{ + +flatbuffers::Offset<circle::SVDFOptions> +build_circle_SVDFOptions(flatbuffers::FlatBufferBuilder &fb, const tflite::Operator *op); + +} // namespace tflite2circle + +#endif // __BBO_SVDF_OPTIONS_H__ |