diff options
Diffstat (limited to 'compiler/tflite2circle')
9 files changed, 144 insertions, 2 deletions
diff --git a/compiler/tflite2circle/CMakeLists.txt b/compiler/tflite2circle/CMakeLists.txt index a0a2e026b..b1d1f6149 100644 --- a/compiler/tflite2circle/CMakeLists.txt +++ b/compiler/tflite2circle/CMakeLists.txt @@ -14,5 +14,6 @@ target_link_libraries(tflite2circle arser) target_link_libraries(tflite2circle safemain) target_link_libraries(tflite2circle mio_tflite) target_link_libraries(tflite2circle mio_circle) +target_link_libraries(tflite2circle vconone) install(TARGETS tflite2circle DESTINATION bin) diff --git a/compiler/tflite2circle/driver/Driver.cpp b/compiler/tflite2circle/driver/Driver.cpp index 67b8e33bc..2f11e0a13 100644 --- a/compiler/tflite2circle/driver/Driver.cpp +++ b/compiler/tflite2circle/driver/Driver.cpp @@ -24,10 +24,25 @@ #include "CircleModel.h" #include "TFLModel.h" +#include <vconone/vconone.h> + +void print_version(void) +{ + std::cout << "tflite2circle version " << vconone::get_string() << std::endl; + std::cout << vconone::get_copyright() << std::endl; +} + int entry(int argc, char **argv) { arser::Arser arser{"tflite2circle is a Tensorflow lite to circle model converter"}; + arser.add_argument("--version") + .nargs(0) + .required(false) + .default_value(false) + .help("Show version information and exit") + .exit_with(print_version); + arser.add_argument("tflite") .nargs(1) .type(arser::DataType::STR) @@ -42,7 +57,7 @@ int entry(int argc, char **argv) { std::cout << err.what() << std::endl; std::cout << arser; - return 0; + return 255; } std::string tfl_path = arser.get<std::string>("tflite"); diff --git a/compiler/tflite2circle/requires.cmake b/compiler/tflite2circle/requires.cmake index ff19b7491..837c287b6 100644 --- a/compiler/tflite2circle/requires.cmake +++ b/compiler/tflite2circle/requires.cmake @@ -2,3 +2,4 @@ require("arser") require("mio-tflite") require("mio-circle") require("safemain") +require("vconone") diff --git a/compiler/tflite2circle/src/BuildBuiltinOptions.h b/compiler/tflite2circle/src/BuildBuiltinOptions.h index 159a8af97..00b3de943 100644 --- a/compiler/tflite2circle/src/BuildBuiltinOptions.h +++ b/compiler/tflite2circle/src/BuildBuiltinOptions.h @@ -62,10 +62,12 @@ #include "BuildBuiltinOptions/MirrorPadOptions.h" #include "BuildBuiltinOptions/MulOptions.h" #include "BuildBuiltinOptions/NegOptions.h" +#include "BuildBuiltinOptions/NonMaxSuppressionV4Options.h" #include "BuildBuiltinOptions/NotEqualOptions.h" #include "BuildBuiltinOptions/OneHotOptions.h" #include "BuildBuiltinOptions/PackOptions.h" #include "BuildBuiltinOptions/PadOptions.h" +#include "BuildBuiltinOptions/PadV2Options.h" #include "BuildBuiltinOptions/RangeOptions.h" #include "BuildBuiltinOptions/Pool2DOptions.h" #include "BuildBuiltinOptions/PowOptions.h" diff --git a/compiler/tflite2circle/src/BuildBuiltinOptions/NonMaxSuppressionV4Options.cpp b/compiler/tflite2circle/src/BuildBuiltinOptions/NonMaxSuppressionV4Options.cpp new file mode 100644 index 000000000..1a39f503b --- /dev/null +++ b/compiler/tflite2circle/src/BuildBuiltinOptions/NonMaxSuppressionV4Options.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2020 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 "NonMaxSuppressionV4Options.h" + +namespace tflite2circle +{ + +flatbuffers::Offset<circle::NonMaxSuppressionV4Options> +build_circle_NonMaxSuppressionV4Options(flatbuffers::FlatBufferBuilder &fb, + const tflite::Operator *) +{ + circle::NonMaxSuppressionV4OptionsBuilder builtin_options_builder{fb}; + return builtin_options_builder.Finish(); +} + +} // namespace tflite2circle diff --git a/compiler/tflite2circle/src/BuildBuiltinOptions/NonMaxSuppressionV4Options.h b/compiler/tflite2circle/src/BuildBuiltinOptions/NonMaxSuppressionV4Options.h new file mode 100644 index 000000000..6073142a8 --- /dev/null +++ b/compiler/tflite2circle/src/BuildBuiltinOptions/NonMaxSuppressionV4Options.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2020 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_NON_MAX_SUPPRESSION_V4_OPTIONS_H__ +#define __BBO_NON_MAX_SUPPRESSION_V4_OPTIONS_H__ + +#include <mio/tflite/schema_generated.h> +#include <mio/circle/schema_generated.h> + +namespace tflite2circle +{ + +flatbuffers::Offset<circle::NonMaxSuppressionV4Options> +build_circle_NonMaxSuppressionV4Options(flatbuffers::FlatBufferBuilder &fb, + const tflite::Operator *op); + +} // namespace tflite2circle + +#endif // __BBO_NON_MAX_SUPPRESSION_V4_OPTIONS_H__ diff --git a/compiler/tflite2circle/src/BuildBuiltinOptions/PadV2Options.cpp b/compiler/tflite2circle/src/BuildBuiltinOptions/PadV2Options.cpp new file mode 100644 index 000000000..6636634a3 --- /dev/null +++ b/compiler/tflite2circle/src/BuildBuiltinOptions/PadV2Options.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2020 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 "PadV2Options.h" + +namespace tflite2circle +{ + +flatbuffers::Offset<circle::PadV2Options> +build_circle_PadV2Options(flatbuffers::FlatBufferBuilder &fb, const tflite::Operator *op) +{ + circle::PadV2OptionsBuilder builtin_options_builder{fb}; + return builtin_options_builder.Finish(); +} + +} // namespace tflite2circle diff --git a/compiler/tflite2circle/src/BuildBuiltinOptions/PadV2Options.h b/compiler/tflite2circle/src/BuildBuiltinOptions/PadV2Options.h new file mode 100644 index 000000000..36a2c82e8 --- /dev/null +++ b/compiler/tflite2circle/src/BuildBuiltinOptions/PadV2Options.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2020 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_PADV2_OPTIONS_H__ +#define __BBO_PADV2_OPTIONS_H__ + +#include <mio/tflite/schema_generated.h> +#include <mio/circle/schema_generated.h> + +namespace tflite2circle +{ + +flatbuffers::Offset<circle::PadV2Options> +build_circle_PadV2Options(flatbuffers::FlatBufferBuilder &fb, const tflite::Operator *op); + +} // namespace tflite2circle + +#endif // __BBO_PADV2_OPTIONS_H__ diff --git a/compiler/tflite2circle/src/TFLBuiltinOptions.lst b/compiler/tflite2circle/src/TFLBuiltinOptions.lst index 3ef9f1575..a2a14538e 100644 --- a/compiler/tflite2circle/src/TFLBuiltinOptions.lst +++ b/compiler/tflite2circle/src/TFLBuiltinOptions.lst @@ -26,6 +26,7 @@ TFL_BUILTIN_OPTIONS(SpaceToDepthOptions) //TFL_BUILTIN_OPTIONS(EmbeddingLookupSparseOptions) TFL_BUILTIN_OPTIONS(MulOptions) TFL_BUILTIN_OPTIONS(PadOptions) +TFL_BUILTIN_OPTIONS(PadV2Options) TFL_BUILTIN_OPTIONS(GatherOptions) TFL_BUILTIN_OPTIONS(BatchToSpaceNDOptions) TFL_BUILTIN_OPTIONS(SpaceToBatchNDOptions) @@ -99,7 +100,7 @@ TFL_BUILTIN_OPTIONS(MatrixSetDiagOptions) TFL_BUILTIN_OPTIONS(IfOptions) TFL_BUILTIN_OPTIONS(WhileOptions) TFL_BUILTIN_OPTIONS(DepthToSpaceOptions) -//TFL_BUILTIN_OPTIONS(NonMaxSuppressionV4Options) +TFL_BUILTIN_OPTIONS(NonMaxSuppressionV4Options) //TFL_BUILTIN_OPTIONS(NonMaxSuppressionV5Options) TFL_BUILTIN_OPTIONS(RankOptions) TFL_BUILTIN_OPTIONS(ScatterNdOptions) |