diff --git a/mindspore/lite/schema/model.fbs b/mindspore/lite/schema/model.fbs index 7cc9e082b4..86bcaabed4 100644 --- a/mindspore/lite/schema/model.fbs +++ b/mindspore/lite/schema/model.fbs @@ -187,7 +187,9 @@ union PrimitiveType { DivGrad, PowerGrad, ActivationGrad, - PriorBox + PriorBox, + SpaceToBatchND, + TopKV2 } enum QuantType: int { diff --git a/mindspore/lite/schema/ops.fbs b/mindspore/lite/schema/ops.fbs index a78b43b349..6070c4d10c 100644 --- a/mindspore/lite/schema/ops.fbs +++ b/mindspore/lite/schema/ops.fbs @@ -677,12 +677,16 @@ table SpaceToBatch { } table SparseToDense { + outputShape: [int]; + sparseValue: [int]; + defaultValue: [int]; validateIndices: bool; } table ReverseSequence { seqAxis: int; batchAxis: int; + seqLengths: [int]; } table Rank { @@ -781,6 +785,7 @@ table ScatterND { } table Unique { + outType: int; } table Unstack { @@ -820,6 +825,7 @@ table OptMomentum { table Where{ + condition: [bool]; } table OneHot { @@ -829,7 +835,7 @@ table OneHot { table Lstm{ bidirection: bool = false; } - + table PriorBox { min_sizes: [int]; max_sizes: [int]; @@ -843,3 +849,14 @@ table PriorBox { flip: bool = true; offset: float; } + +table SpaceToBatchND { + blockShape : [int]; + paddings : [int]; +} + +table TopKV2 { + k : [int]; + sorted : bool = true; +} + diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.cc index 7dc4a67b7a..a1c981ca61 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.h" +#include "tools/converter/parser/tflite/tflite_add_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.h index 5add90acf5..cb5c04d1f8 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_addn_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_addn_parser.cc new file mode 100644 index 0000000000..70905aaebc --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_addn_parser.cc @@ -0,0 +1,44 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_addn_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteAddNParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteAddNParser"; + std::unique_ptr attr(new schema::AddNT()); + attr->N = tflite_tensors.size(); + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_AddN; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteAddNParser("AddN", new TfliteAddNParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_addn_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_addn_parser.h new file mode 100644 index 0000000000..bdc51bfc48 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_addn_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_ADDN_PARSER_H +#define LITE_TFLITE_ADDN_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteAddNParser : public TfliteNodeParser { + public: + TfliteAddNParser() : TfliteNodeParser("AddN") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_ADDN_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.cc index 0ee666776b..30706902b8 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.h" +#include "tools/converter/parser/tflite/tflite_argmax_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.h index a96305e911..0665a6b028 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.cc index e437eb11b3..2ff86ae045 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.h" +#include "tools/converter/parser/tflite/tflite_argmin_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.h index 4bac32a1e5..a02d4fe5e2 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_batch_to_space_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_batch_to_space_parser.cc new file mode 100644 index 0000000000..6fe391f4b6 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_batch_to_space_parser.cc @@ -0,0 +1,51 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_batch_to_space_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteBatchToSpaceParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteBatchToSpaceParser"; + std::unique_ptr attr(new schema::BatchToSpaceT()); + if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->blockShape)) { + MS_LOG(ERROR) << "batchToSpace -> blockShape get failed"; + return RET_ERROR; + } + if (GetTfliteData(tflite_op->inputs[2], tflite_tensors, tflite_model_buffer, attr->crops)) { + MS_LOG(ERROR) << "batchToSpace -> crops get failed"; + return RET_ERROR; + } + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_BatchToSpace; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteBatchToSpaceParser("BatchToSpace", new TfliteBatchToSpaceParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_batch_to_space_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_batch_to_space_parser.h new file mode 100644 index 0000000000..37f20766a9 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_batch_to_space_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_BATCH_TO_SPACE_PARSER_H +#define LITE_TFLITE_BATCH_TO_SPACE_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteBatchToSpaceParser : public TfliteNodeParser { + public: + TfliteBatchToSpaceParser() : TfliteNodeParser("BatchToSpace") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_BATCH_TO_SPACE_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_broadcast_to_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_broadcast_to_parser.cc new file mode 100644 index 0000000000..bc508ef7d6 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_broadcast_to_parser.cc @@ -0,0 +1,47 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_broadcast_to_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteBroadcastToParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteBroadcastToParser"; + std::unique_ptr attr(new schema::BroadcastToT()); + if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->dst_shape)) { + MS_LOG(ERROR) << "broadCastTo -> dst_shape get failed"; + return RET_ERROR; + } + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_BroadcastTo; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteBroadcastToParser("BroadcastTo", new TfliteBroadcastToParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_broadcast_to_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_broadcast_to_parser.h new file mode 100644 index 0000000000..0bbebd449b --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_broadcast_to_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_BROADCAST_TO_PARSER_H +#define LITE_TFLITE_BROADCAST_TO_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteBroadcastToParser : public TfliteNodeParser { + public: + TfliteBroadcastToParser() : TfliteNodeParser("BroadcastTo") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_BROADCAST_TO_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_cast_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_cast_parser.cc new file mode 100644 index 0000000000..d81fb87075 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_cast_parser.cc @@ -0,0 +1,51 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_cast_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteCastParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteCastParser"; + std::unique_ptr attr(new schema::CastT()); + const auto &tflite_attr = tflite_op->builtin_options.AsCastOptions(); + if (tflite_attr == nullptr) { + MS_LOG(ERROR) << "get op:" << op->name.c_str() << " attr failed"; + return RET_NULL_PTR; + } + + attr->srcT = tflite_attr->in_data_type; + attr->dstT = tflite_attr->out_data_type; + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_Cast; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + + TfliteNodeRegister g_tfliteCastParser("Cast", new TfliteCastParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_cast_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_cast_parser.h new file mode 100644 index 0000000000..935389d5ba --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_cast_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_CAST_PARSER_H +#define LITE_TFLITE_CAST_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteCastParser : public TfliteNodeParser { + public: + TfliteCastParser() : TfliteNodeParser("Cast") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_CAST_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.cc index 00c0d57d3c..c8902c5f41 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.h" +#include "tools/converter/parser/tflite/tflite_ceil_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.h index c58d68f35f..289c7b40c7 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.cc index eddce292d8..5dbe6b2fea 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.h" +#include "tools/converter/parser/tflite/tflite_concat_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.h index 47e767f025..d2a1acff77 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.cc index 594fa2245b..66c2c13492 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.h" +#include "tools/converter/parser/tflite/tflite_conv_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.h index 421d696829..d2f523a0c3 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_converter.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_converter.cc index 11ce6cec81..825deec6f9 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_converter.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_converter.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_converter.h" +#include "tools/converter/parser/tflite/tflite_converter.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_converter.h b/mindspore/lite/tools/converter/parser/tflite/tflite_converter.h index 4c85595ffb..88f0710851 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_converter.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_converter.h @@ -19,9 +19,9 @@ #include #include -#include "mindspore/lite/tools/converter/converter.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h" -#include "mindspore/lite/tools/converter/graphdef_transform.h" +#include "tools/converter/converter.h" +#include "tools/converter/parser/tflite/tflite_model_parser.h" +#include "tools/converter/graphdef_transform.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_depth_to_space_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_depth_to_space_parser.cc new file mode 100644 index 0000000000..0c441396c8 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_depth_to_space_parser.cc @@ -0,0 +1,50 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_depth_to_space_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteDepthToSpaceParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteDepthToSpaceParser"; + std::unique_ptr attr(new schema::DepthToSpaceT()); + const auto &tflite_attr = tflite_op->builtin_options.AsDepthToSpaceOptions(); + if (tflite_attr == nullptr) { + MS_LOG(ERROR) << "get op: %s attr failed", op->name.c_str(); + return RET_NULL_PTR; + } + attr->blockSize = tflite_attr->block_size; + attr->format = schema::Format_NHWC; + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_DepthToSpace; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteDepthToSpaceParser("DepthToSpace", new TfliteDepthToSpaceParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_depth_to_space_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_depth_to_space_parser.h new file mode 100644 index 0000000000..3be9968d8d --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_depth_to_space_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_DEPTH_TO_SPACE_PARSER_H +#define LITE_TFLITE_DEPTH_TO_SPACE_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteDepthToSpaceParser : public TfliteNodeParser { + public: + TfliteDepthToSpaceParser() : TfliteNodeParser("DepthToSpace") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_DEPTH_TO_SPACE_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.cc index 3c852e3898..0d231d73dd 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.h" +#include "tools/converter/parser/tflite/tflite_depthwise_conv_parser.h" #include "tools/common/node_util.h" namespace mindspore { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.h index 0c28b3fd45..2e0b1a0d02 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.cc index 98b8e024ea..c9d52f6cab 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.h" +#include "tools/converter/parser/tflite/tflite_div_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.h index f0d928d72a..1a82a0f806 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_equal_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_equal_parser.cc new file mode 100644 index 0000000000..3ef4ddd286 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_equal_parser.cc @@ -0,0 +1,43 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_equal_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteEqualParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteEqualParser"; + std::unique_ptr attr(new schema::EqualT()); + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_Equal; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteEqualParser("Equal", new TfliteEqualParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_equal_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_equal_parser.h new file mode 100644 index 0000000000..3435285b2a --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_equal_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_EQUAL_PARSER_H +#define LITE_TFLITE_EQUAL_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteEqualParser : public TfliteNodeParser { + public: + TfliteEqualParser() : TfliteNodeParser("Equal") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_EQUAL_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.cc index 98291ca3e8..3c42bf4d3b 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.h" +#include "tools/converter/parser/tflite/tflite_expand_dims_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.h index e920d3833e..aa867bc315 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_fakequant_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_fakequant_parser.h index e4c0441a55..101c6cfec1 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_fakequant_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_fakequant_parser.h @@ -18,8 +18,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.cc index 84cb68977b..e41141b560 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.h" +#include "tools/converter/parser/tflite/tflite_fill_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.h index 596136f0b7..5d8fdee06d 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.cc index 277eb76612..2f38e6a35e 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.h" +#include "tools/converter/parser/tflite/tflite_floor_div_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.h index 9e4e97f3b1..3ee5f51305 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.cc index 8c9755a04d..ea99cef833 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.h" +#include "tools/converter/parser/tflite/tflite_floor_mod_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.h index 3a034f8f64..b0ed989508 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.cc index f68298c536..70abaef920 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.h" +#include "tools/converter/parser/tflite/tflite_floor_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.h index 3ba3996d06..7db0e83324 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.cc index 5ffac0d844..8ee363335f 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.h" +#include "tools/converter/parser/tflite/tflite_fullyconnected_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.h index 9906e7d90e..f41ab2e3c0 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.cc index 850d3f787e..41841f4a28 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.h" +#include "tools/converter/parser/tflite/tflite_gather_nd_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.h index e7f0487976..18b8b5531d 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.cc index 4283af7aea..4c9efde2b4 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.h" +#include "tools/converter/parser/tflite/tflite_gather_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.h index 22ae3d45ac..5dd842414a 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.cc index c803b16d77..514fe5280c 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.h" +#include "tools/converter/parser/tflite/tflite_gather_v2_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.h index adec75cb81..d9acc3721d 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_greater_equal_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_greater_equal_parser.cc new file mode 100644 index 0000000000..0ca417a180 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_greater_equal_parser.cc @@ -0,0 +1,43 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_greater_equal_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteGreaterEqualParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteGreaterEqualParser"; + std::unique_ptr attr(new schema::GreaterEqualT()); + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_GreaterEqual; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteGreaterEqualParser("GreaterEqual", new TfliteGreaterEqualParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_greater_equal_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_greater_equal_parser.h new file mode 100644 index 0000000000..aacd8e3ab0 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_greater_equal_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_GREATER_EQUAL_PARSER_H +#define LITE_TFLITE_GREATER_EQUAL_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteGreaterEqualParser : public TfliteNodeParser { + public: + TfliteGreaterEqualParser() : TfliteNodeParser("GreaterEqual") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_GREATER_EQUAL_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_greater_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_greater_parser.cc new file mode 100644 index 0000000000..c706140dc6 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_greater_parser.cc @@ -0,0 +1,43 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_greater_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteGreaterParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteGreaterParser"; + std::unique_ptr attr(new schema::GreaterT()); + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_Greater; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteGreaterParser("Greater", new TfliteGreaterParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_greater_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_greater_parser.h new file mode 100644 index 0000000000..99ab59c1f6 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_greater_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_GREATER_PARSER_H +#define LITE_TFLITE_GREATER_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteGreaterParser : public TfliteNodeParser { + public: + TfliteGreaterParser() : TfliteNodeParser("Greater") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_GREATER_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.cc index ceec81c6c8..aaf9366e81 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.h" +#include "tools/converter/parser/tflite/tflite_inner_product_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.h index 1e87c5d154..0505e8ce23 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.cc index 0ef3cfbce1..f04c65c4d3 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.h" +#include "tools/converter/parser/tflite/tflite_leaky_relu_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.h index 2118504d5b..bce9c90a9f 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.h @@ -17,8 +17,8 @@ #ifndef PREDICT_TFLITE_LEAKY_RELU_PARSER_H #define PREDICT_TFLITE_LEAKY_RELU_PARSER_H -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_less_equal_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_less_equal_parser.cc new file mode 100644 index 0000000000..72f26ebc6e --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_less_equal_parser.cc @@ -0,0 +1,43 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_less_equal_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteLessEqualParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteLessEqualParser"; + std::unique_ptr attr(new schema::LessEqualT()); + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_LessEqual; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteLessEqualParser("LessEqual", new TfliteLessEqualParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_less_equal_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_less_equal_parser.h new file mode 100644 index 0000000000..87fa8cedd8 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_less_equal_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_LESS_EQUAL_PARSER_H +#define LITE_TFLITE_LESS_EQUAL_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteLessEqualParser : public TfliteNodeParser { + public: + TfliteLessEqualParser() : TfliteNodeParser("LessEqual") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_LESS_EQUAL_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_less_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_less_parser.cc new file mode 100644 index 0000000000..250272aa1f --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_less_parser.cc @@ -0,0 +1,43 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_less_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteLessParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteLessParser"; + std::unique_ptr attr(new schema::LessT()); + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_Less; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteLessParser("Less", new TfliteLessParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_less_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_less_parser.h new file mode 100644 index 0000000000..7cbe1c38da --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_less_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_LESS_PARSER_H +#define LITE_TFLITE_LESS_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteLessParser : public TfliteNodeParser { + public: + TfliteLessParser() : TfliteNodeParser("Less") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_LESS_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.cc index b930647403..bb254f2c3e 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.h" +#include "tools/converter/parser/tflite/tflite_logistic_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.h index 3e98637a0c..6c5402faa8 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.cc index ea502dfb92..3ac19a2920 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.h" +#include "tools/converter/parser/tflite/tflite_lrn_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.h index 89153e2831..b7eae4f978 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.cc index 490845a5ec..387b0302e2 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.h" +#include "tools/converter/parser/tflite/tflite_max_pooling_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.h index dc07947ba8..0893b580ca 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.cc index d54b45e8e9..2ec3e0221f 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.h" +#include "tools/converter/parser/tflite/tflite_mean_pooling_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.h index a1208c6d1c..9f1dca30a2 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.cc index b52e4b12f0..eebe4941f5 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h" +#include "tools/converter/parser/tflite/tflite_model_parser.h" #include #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h index 00b0520946..0ebd9a7199 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h @@ -29,8 +29,8 @@ #include #include "securec/include/securec.h" -#include "mindspore/lite/tools/converter/model_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/model_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" #include "tools/common/tensor_util.h" #include "mindspore/lite/schema/inner/model_generated.h" diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.cc index 3c085a449e..7d6647171e 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.h" +#include "tools/converter/parser/tflite/tflite_mul_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.h index 90906df3ea..5514c1af4e 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.cc index 4982853e94..54167499b6 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.cc @@ -18,7 +18,7 @@ #include #include #include "securec/include/securec.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.cc index e6b7b4dc71..93e3974a5b 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h b/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h index 8649c3cf6a..c2b533e241 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h @@ -20,7 +20,7 @@ #include #include #include "tools/common/node_util.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_not_equal_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_not_equal_parser.cc new file mode 100644 index 0000000000..c2dafab666 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_not_equal_parser.cc @@ -0,0 +1,43 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_not_equal_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteNotEqualParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteNotEqualParser"; + std::unique_ptr attr(new schema::NotEqualT()); + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_NotEqual; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteNotEqualParser("NotEqual", new TfliteNotEqualParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_not_equal_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_not_equal_parser.h new file mode 100644 index 0000000000..bf69218ae4 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_not_equal_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_NOT_EQUAL_PARSER_H +#define LITE_TFLITE_NOT_EQUAL_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteNotEqualParser : public TfliteNodeParser { + public: + TfliteNotEqualParser() : TfliteNodeParser("NotEqual") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_NOT_EQUAL_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_p_relu_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_p_relu_parser.cc new file mode 100644 index 0000000000..92ec67de8f --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_p_relu_parser.cc @@ -0,0 +1,45 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_p_relu_parser.h" + +namespace mindspore { +namespace lite { +STATUS TflitePreluParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "paser TflitePreluParser"; + std::unique_ptr attr(new schema::PreluT()); + if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->slope)) { + MS_LOG(ERROR) << "pRelu -> slope get failed"; + return RET_ERROR; + } + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_Prelu; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tflitePreluParser("Prelu", new TflitePreluParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_p_relu_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_p_relu_parser.h new file mode 100644 index 0000000000..5e79ce6914 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_p_relu_parser.h @@ -0,0 +1,40 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_P_RELU_PARSER_H +#define LITE_TFLITE_P_RELU_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TflitePreluParser : public TfliteNodeParser { + public: + TflitePreluParser() : TfliteNodeParser("Prelu") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_P_RELU_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.cc index 51b7a91139..a49e032894 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.h" +#include "tools/converter/parser/tflite/tflite_pad_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.h index ec4084ae7e..e2f0c29c7b 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.cc index cf229a989f..aac929ff7a 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.h" +#include "tools/converter/parser/tflite/tflite_pow_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.h index 29aba5952b..e3a6b07bf9 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.cc index 88081ad591..ee7e66d2db 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.h" +#include "tools/converter/parser/tflite/tflite_range_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.h index d24cf53239..2701590151 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.cc index 2062d1e555..bb64242230 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.h" +#include "tools/converter/parser/tflite/tflite_rank_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.h index 90d1eb3007..11257b6f2b 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_real_div_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_real_div_parser.cc new file mode 100644 index 0000000000..12dbd47878 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_real_div_parser.cc @@ -0,0 +1,43 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_real_div_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteRealDivParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteRealDivParser"; + std::unique_ptr attr(new schema::RealDivT()); + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_RealDiv; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteRealDivParser("RealDiv", new TfliteRealDivParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_real_div_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_real_div_parser.h new file mode 100644 index 0000000000..110e813d0e --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_real_div_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_REAL_DIV_PARSER_H +#define LITE_TFLITE_REAL_DIV_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteRealDivParser : public TfliteNodeParser { + public: + TfliteRealDivParser() : TfliteNodeParser("RealDiv") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_REAL_DIV_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.cc index 513a57fa63..657c3eaf17 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.h" +#include "tools/converter/parser/tflite/tflite_relu6_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.h index 57d5300e68..3d1f84ff0c 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.h @@ -17,8 +17,8 @@ #ifndef PREDICT_TFLITE_RELU6_PARSER_H #define PREDICT_TFLITE_RELU6_PARSER_H -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.cc index 443682e203..31877c8d8f 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.h" +#include "tools/converter/parser/tflite/tflite_relu_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.h index b5964a22a7..7b67e0c4ee 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.h @@ -17,8 +17,8 @@ #ifndef PREDICT_TFLITE_RELU_PARSER_H #define PREDICT_TFLITE_RELU_PARSER_H -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.cc index bbb1d28b25..dd393860c3 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.h" +#include "tools/converter/parser/tflite/tflite_reshape_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.h index a4237d3f05..a122d9512f 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.cc index cb7e7a1d9a..13c7eb48c1 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.h" +#include "tools/converter/parser/tflite/tflite_resize_bilinear_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.h index 4792f91436..bbe48edd51 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_resize_nearest_neighbor_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_resize_nearest_neighbor_parser.cc index c957811fb2..20438d63a4 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_resize_nearest_neighbor_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_resize_nearest_neighbor_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_resize_nearest_neighbor_parser.h" +#include "tools/converter/parser/tflite/tflite_resize_nearest_neighbor_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_resize_nearest_neighbor_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_resize_nearest_neighbor_parser.h index d68b99b6ad..4657a67d96 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_resize_nearest_neighbor_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_resize_nearest_neighbor_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_parser.cc index f1d1b17a70..f516d7e2d1 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_reverse_parser.h" +#include "tools/converter/parser/tflite/tflite_reverse_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_parser.h index 12a79becec..1db4301566 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_sequence_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_sequence_parser.cc new file mode 100644 index 0000000000..3658541d98 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_sequence_parser.cc @@ -0,0 +1,49 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_reverse_sequence_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteReverseSequenceParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteReverseSequenceParser"; + std::unique_ptr attr(new schema::ReverseSequenceT()); + const auto &tflite_attr = tflite_op->builtin_options.AsReverseSequenceOptions(); + + attr->seqAxis = tflite_attr->seq_dim; + attr->batchAxis = tflite_attr->batch_dim; + if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->seqLengths)) { + return RET_ERROR; + } + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_ReverseSequence; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteReverseSequenceParser("ReverseSequence", new TfliteReverseSequenceParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_sequence_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_sequence_parser.h new file mode 100644 index 0000000000..20cac753e1 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_reverse_sequence_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_REVERSE_SEQUENCE_PARSER_H +#define LITE_TFLITE_REVERSE_SEQUENCE_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteReverseSequenceParser : public TfliteNodeParser { + public: + TfliteReverseSequenceParser() : TfliteNodeParser("ReverseSequence") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_REVERSE_SEQUENCE_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_round_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_round_parser.cc new file mode 100644 index 0000000000..3e385c8e44 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_round_parser.cc @@ -0,0 +1,43 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_round_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteRoundParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteRoundParser"; + std::unique_ptr attr(new schema::RoundT()); + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_Round; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteRoundParser("Round", new TfliteRoundParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_round_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_round_parser.h new file mode 100644 index 0000000000..060f4d0991 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_round_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_ROUND_PARSER_H +#define LITE_TFLITE_ROUND_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteRoundParser : public TfliteNodeParser { + public: + TfliteRoundParser() : TfliteNodeParser("Round") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_ROUND_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_sigmoid_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_sigmoid_parser.cc index 555ea13cad..fcfe4110d1 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_sigmoid_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_sigmoid_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_sigmoid_parser.h" +#include "tools/converter/parser/tflite/tflite_sigmoid_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_sigmoid_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_sigmoid_parser.h index 6d21059269..f291125964 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_sigmoid_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_sigmoid_parser.h @@ -17,8 +17,8 @@ #ifndef PREDICT_TFLITE_SIGMOID_PARSER_H #define PREDICT_TFLITE_SIGMOID_PARSER_H -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_slice_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_slice_parser.cc index 2cdb66e4c0..9f74bddd8f 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_slice_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_slice_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_slice_parser.h" +#include "tools/converter/parser/tflite/tflite_slice_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_slice_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_slice_parser.h index 965b128b67..70c1b96da7 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_slice_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_slice_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_softmax_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_softmax_parser.cc index b30f7b8b65..07bb3a9507 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_softmax_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_softmax_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_softmax_parser.h" +#include "tools/converter/parser/tflite/tflite_softmax_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_softmax_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_softmax_parser.h index 728ed6bacf..685898c429 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_softmax_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_softmax_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_space_to_batch_nd_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_space_to_batch_nd_parser.cc new file mode 100644 index 0000000000..ea3c2c8a3f --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_space_to_batch_nd_parser.cc @@ -0,0 +1,51 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_space_to_batch_nd_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteSpaceToBatchNDParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteSpaceToBatchNDParser"; + std::unique_ptr attr(new schema::SpaceToBatchNDT()); + if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->blockShape)) { + MS_LOG(ERROR) << "spaceToBatchND -> blockShape get failed"; + return RET_ERROR; + } + if (GetTfliteData(tflite_op->inputs[2], tflite_tensors, tflite_model_buffer, attr->paddings)) { + MS_LOG(ERROR) << "spaceToBatchND -> paddings get failed"; + return RET_ERROR; + } + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_SpaceToBatchND; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteSpaceToBatchNDParser("SpaceToBatchND", new TfliteSpaceToBatchNDParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_space_to_batch_nd_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_space_to_batch_nd_parser.h new file mode 100644 index 0000000000..287f492bc6 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_space_to_batch_nd_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_SPACE_TO_BATCH_ND_PARSER_H +#define LITE_TFLITE_SPACE_TO_BATCH_ND_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteSpaceToBatchNDParser : public TfliteNodeParser { + public: + TfliteSpaceToBatchNDParser() : TfliteNodeParser("SpaceToBatchND") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_SPACE_TO_BATCH_ND_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_space_to_depth_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_space_to_depth_parser.cc new file mode 100644 index 0000000000..e3435bc5f3 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_space_to_depth_parser.cc @@ -0,0 +1,51 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_space_to_depth_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteSpaceToDepthParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteSpaceToDepthParser"; + std::unique_ptr attr(new schema::SpaceToDepthT()); + const auto &tflite_attr = tflite_op->builtin_options.AsSpaceToDepthOptions(); + if (tflite_attr == nullptr) { + MS_LOG(ERROR) << "get op:" << op->name.c_str() << " attr failed"; + return RET_NULL_PTR; + } + + attr->blockSize = tflite_attr->block_size; + attr->format = schema::Format_NHWC; + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_SpaceToDepth; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteSpaceToDepthParser("SpaceToDepth", new TfliteSpaceToDepthParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_space_to_depth_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_space_to_depth_parser.h new file mode 100644 index 0000000000..3adf534253 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_space_to_depth_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_SPACE_TO_DEPTH_PARSER_H +#define LITE_TFLITE_SPACE_TO_DEPTH_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteSpaceToDepthParser : public TfliteNodeParser { + public: + TfliteSpaceToDepthParser() : TfliteNodeParser("SpaceToDepth") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_SPACE_TO_DEPTH_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_sparse_to_dense_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_sparse_to_dense_parser.cc new file mode 100644 index 0000000000..8e805acd97 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_sparse_to_dense_parser.cc @@ -0,0 +1,62 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_sparse_to_dense_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteSparseToDenseParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteSparseToDenseParser"; + std::unique_ptr attr(new schema::SparseToDenseT()); + const auto &tflite_attr = tflite_op->builtin_options.AsSparseToDenseOptions(); + if (tflite_attr == nullptr) { + MS_LOG(ERROR) << "get op:" << op->name.c_str() << " attr failed"; + return RET_NULL_PTR; + } + + if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->outputShape)) { + MS_LOG(ERROR) << "sparseToDense -> outputShape get failed"; + return RET_ERROR; + } + if (GetTfliteData(tflite_op->inputs[2], tflite_tensors, tflite_model_buffer, attr->sparseValue)) { + MS_LOG(ERROR) << "sparseToDense -> sparseValue get failed"; + return RET_ERROR; + } + if (GetTfliteData(tflite_op->inputs[3], tflite_tensors, tflite_model_buffer, attr->defaultValue)) { + MS_LOG(ERROR) << "sparseToDense -> defaultValue get failed"; + return RET_ERROR; + } + attr->validateIndices = tflite_attr->validate_indices; + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_SparseToDense; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteSparseToDenseParser("SparseToDense", new TfliteSparseToDenseParser()); +} // namespace lite +} // namespace mindspore + diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_sparse_to_dense_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_sparse_to_dense_parser.h new file mode 100644 index 0000000000..d1d2b35291 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_sparse_to_dense_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_SPARSE_TO_DENSE_PARSER_H +#define LITE_TFLITE_SPARSE_TO_DENSE_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteSparseToDenseParser : public TfliteNodeParser { + public: + TfliteSparseToDenseParser() : TfliteNodeParser("SparseToDense") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_SPARSE_TO_DENSE_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_square_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_square_parser.h index 5282d9bd76..7e349a6b89 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_square_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_square_parser.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef PREDICT_TFLITE_SQUARE_PARSER_H -#define PREDICT_TFLITE_SQUARE_PARSER_H +#ifndef LITE_TFLITE_SQUARE_PARSER_H +#define LITE_TFLITE_SQUARE_PARSER_H #include #include @@ -28,14 +28,15 @@ class TfliteSquareParser : public TfliteNodeParser { public: TfliteSquareParser() : TfliteNodeParser("Square") {} - STATUS Parse(const std::unique_ptr &tfliteOp, - const std::vector> &tfliteTensors, - const std::vector> &tfliteModelBuffer, - const std::vector> &tfliteOpSet, schema::CNodeT *op, + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, TensorCache *tensor_cache, - bool quantizedModel) override; + bool quantized_model) override; }; } // namespace lite } // namespace mindspore -#endif // PREDICT_TFLITE_SQUARE_PARSER_H +#endif // LITE_TFLITE_SQUARE_PARSER_H + diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_squared_difference_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_squared_difference_parser.h index d2e659cb6b..67dd05b109 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_squared_difference_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_squared_difference_parser.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef PREDICT_TFLITE_SQUARED_DIFFERENCE_PARSER_H -#define PREDICT_TFLITE_SQUARED_DIFFERENCE_PARSER_H +#ifndef LITE_TFLITE_SQUARED_DIFFERENCE_PARSER_H +#define LITE_TFLITE_SQUARED_DIFFERENCE_PARSER_H #include #include @@ -28,14 +28,15 @@ class TfliteSquaredDifferenceParser : public TfliteNodeParser { public: TfliteSquaredDifferenceParser() : TfliteNodeParser("SquaredDifference") {} - STATUS Parse(const std::unique_ptr &tfliteOp, - const std::vector> &tfliteTensors, - const std::vector> &tfliteModelBuffer, - const std::vector> &tfliteOpSet, schema::CNodeT *op, - TensorCache *tensor_cache, bool quantizedModel) override; + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; }; } // namespace lite } // namespace mindspore -#endif // PREDICT_TFLITE_SQUARED_DIFFERENCE_PARSER_H +#endif // LITE_TFLITE_SQUARED_DIFFERENCE_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_stack_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_stack_parser.cc index 74a0e24ab7..43d76b3c56 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_stack_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_stack_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_stack_parser.h" +#include "tools/converter/parser/tflite/tflite_stack_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_stack_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_stack_parser.h index b659d671e4..db85b07828 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_stack_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_stack_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_strided_slice_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_strided_slice_parser.cc index f174b2a66c..44843a550f 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_strided_slice_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_strided_slice_parser.cc @@ -20,37 +20,40 @@ namespace mindspore { namespace lite { -STATUS TfliteStridedSliceParser::Parse(const std::unique_ptr &tfliteOp, - const std::vector> &tfliteTensors, - const std::vector> &tfliteModelBuffer, - const std::vector> &tfliteOpSet, - schema::CNodeT *op, TensorCache *tensor_cache, bool quantizedModel) { - MS_LOG(INFO) << "parse TfliteStridedSliceParser"; +STATUS TfliteStridedSliceParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteStridedSliceParser"; std::unique_ptr attr(new schema::StridedSliceT()); - const auto &tflite_attr = tfliteOp->builtin_options.AsStridedSliceOptions(); + const auto &tflite_attr = tflite_op->builtin_options.AsStridedSliceOptions(); if (tflite_attr == nullptr) { - MS_LOG(ERROR) << "get op: " << op->name << " attr failed"; + MS_LOG(ERROR) << "get op: %s attr failed", op->name.c_str(); return RET_NULL_PTR; } - if (GetTfliteData(tfliteOp->inputs[1], tfliteTensors, tfliteModelBuffer, attr->begin)) { - MS_LOG(ERROR) << "STRIDED_SLICE get begin attr failed"; + attr->beginMask = tflite_attr->begin_mask; + attr->endMask = tflite_attr->end_mask; + attr->ellipsisMask = tflite_attr->ellipsis_mask; + attr->newAxisMask = tflite_attr->new_axis_mask; + attr->shrinkAxisMask = tflite_attr->shrink_axis_mask; + + if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->begin)) { + MS_LOG(ERROR) << "stridedSlice -> begin get failed"; return RET_ERROR; } - if (GetTfliteData(tfliteOp->inputs[2], tfliteTensors, tfliteModelBuffer, attr->end)) { - MS_LOG(ERROR) << "STRIDED_SLICE get end attr failed"; + if (GetTfliteData(tflite_op->inputs[2], tflite_tensors, tflite_model_buffer, attr->end)) { + MS_LOG(ERROR) << "stridedSlice -> end get failed"; return RET_ERROR; } - if (GetTfliteData(tfliteOp->inputs[3], tfliteTensors, tfliteModelBuffer, attr->stride)) { - MS_LOG(ERROR) << "STRIDED_SLICE get stride attr failed"; + if (GetTfliteData(tflite_op->inputs[3], tflite_tensors, tflite_model_buffer, attr->stride)) { + MS_LOG(ERROR) << "stridedSlice -> stride get failed"; return RET_ERROR; } - attr->beginMask = tflite_attr->begin_mask; - attr->endMask = tflite_attr->end_mask; - attr->ellipsisMask = tflite_attr->ellipsis_mask; - attr->newAxisMask = tflite_attr->new_axis_mask; - attr->shrinkAxisMask = tflite_attr->shrink_axis_mask; - // attr->isScale; // isScale is actually not used in ms-lite + attr->isScale.assign(tflite_tensors[tflite_op->inputs[0]]->shape.begin(), + tflite_tensors[tflite_op->inputs[0]]->shape.end()); if (op != nullptr) { op->primitive = std::make_unique(); @@ -60,6 +63,6 @@ STATUS TfliteStridedSliceParser::Parse(const std::unique_ptr return RET_OK; } -TfliteNodeRegister g_TfliteStridedSliceParser("StridedSlice", new TfliteStridedSliceParser()); +TfliteNodeRegister g_tfliteStridedSliceParser("StridedSlice", new TfliteStridedSliceParser()); } // namespace lite } // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_strided_slice_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_strided_slice_parser.h index 10596a96b0..4a2b1814db 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_strided_slice_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_strided_slice_parser.h @@ -14,8 +14,9 @@ * limitations under the License. */ -#ifndef PREDICT_TFLITE_STRIDED_SLICE_PARSER_H -#define PREDICT_TFLITE_STRIDED_SLICE_PARSER_H + +#ifndef LITE_TFLITE_STRIDED_SLICE_PARSER_H +#define LITE_TFLITE_STRIDED_SLICE_PARSER_H #include #include @@ -28,14 +29,15 @@ class TfliteStridedSliceParser : public TfliteNodeParser { public: TfliteStridedSliceParser() : TfliteNodeParser("StridedSlice") {} - STATUS Parse(const std::unique_ptr &tfliteOp, - const std::vector> &tfliteTensors, - const std::vector> &tfliteModelBuffer, - const std::vector> &tfliteOpSet, schema::CNodeT *op, + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, TensorCache *tensor_cache, - bool quantizedModel) override; + bool quantized_model) override; }; } // namespace lite } // namespace mindspore -#endif // PREDICT_TFLITE_STRIDED_SLICE_PARSER_H +#endif // LITE_TFLITE_STRIDED_SLICE_PARSER_H + diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_sub_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_sub_parser.cc index fcd4ed5501..0590734bf0 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_sub_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_sub_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_sub_parser.h" +#include "tools/converter/parser/tflite/tflite_sub_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_sub_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_sub_parser.h index fd25ed3fea..f84c30c781 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_sub_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_sub_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_tanh_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_tanh_parser.cc index 70c0e15faa..f78b8fa71e 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_tanh_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_tanh_parser.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_tanh_parser.h" +#include "tools/converter/parser/tflite/tflite_tanh_parser.h" #include #include diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_tanh_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_tanh_parser.h index 4449589ff4..38a003d87a 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_tanh_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_tanh_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_tile_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_tile_parser.cc new file mode 100644 index 0000000000..c3e259fa27 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_tile_parser.cc @@ -0,0 +1,48 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_tile_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteTileParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteTileParser"; + std::unique_ptr attr(new schema::TileT()); + + if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->multiples)) { + MS_LOG(ERROR) << "tile -> multiples get failed"; + return RET_ERROR; + } + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_Tile; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteTileParser("Tile", new TfliteTileParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_tile_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_tile_parser.h new file mode 100644 index 0000000000..48ba12053a --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_tile_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_TILE_PARSER_H +#define LITE_TFLITE_TILE_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteTileParser : public TfliteNodeParser { + public: + TfliteTileParser() : TfliteNodeParser("Tile") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_TILE_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_topk_v2_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_topk_v2_parser.cc new file mode 100644 index 0000000000..c086eab7d4 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_topk_v2_parser.cc @@ -0,0 +1,47 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_topk_v2_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteTopKV2Parser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteTopKV2Parser"; + std::unique_ptr attr(new schema::TopKV2T()); + + if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->k)) { + MS_LOG(ERROR) << "topKV2 -> k get failed"; + return RET_ERROR; + } + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_TopKV2; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteTopKV2Parser("TopKV2", new TfliteTopKV2Parser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_topk_v2_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_topk_v2_parser.h new file mode 100644 index 0000000000..3bf9c1dabf --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_topk_v2_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_TOPK_V2_PARSER_H +#define LITE_TFLITE_TOPK_V2_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteTopKV2Parser : public TfliteNodeParser { + public: + TfliteTopKV2Parser() : TfliteNodeParser("TopKV2") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_TOPK_V2_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_transpose_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_transpose_parser.cc index 62ee42fe21..1aa59ac73e 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_transpose_parser.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_transpose_parser.cc @@ -16,7 +16,7 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_transpose_parser.h" +#include "tools/converter/parser/tflite/tflite_transpose_parser.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_transpose_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_transpose_parser.h index 89c57c2bc8..f92eed0c54 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_transpose_parser.h +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_transpose_parser.h @@ -19,8 +19,8 @@ #include #include -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" -#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h" +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_unique_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_unique_parser.cc new file mode 100644 index 0000000000..fe386d5736 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_unique_parser.cc @@ -0,0 +1,49 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_unique_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteUniqueParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteUniqueParser"; + std::unique_ptr attr(new schema::UniqueT()); + const auto &tflite_attr = tflite_op->builtin_options.AsUniqueOptions(); + if (tflite_attr == nullptr) { + MS_LOG(ERROR) << "get op: %s attr failed", op->name.c_str(); + return RET_NULL_PTR; + } + + attr->outType = GetTfliteDataType(tflite_attr->idx_out_type); + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_Unique; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteUniqueParser("Unique", new TfliteUniqueParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_unique_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_unique_parser.h new file mode 100644 index 0000000000..f0e3b30c45 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_unique_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_UNIQUE_PARSER_H +#define LITE_TFLITE_UNIQUE_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteUniqueParser : public TfliteNodeParser { + public: + TfliteUniqueParser() : TfliteNodeParser("Unique") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_UNIQUE_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_unstack_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_unstack_parser.cc new file mode 100644 index 0000000000..eca413ba7a --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_unstack_parser.cc @@ -0,0 +1,50 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_unstack_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteUnstackParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "paser TfliteUnstackParser"; + std::unique_ptr attr(new schema::UnstackT()); + const auto &tflite_attr = tflite_op->builtin_options.AsUnpackOptions(); + if (tflite_attr == nullptr) { + MS_LOG(ERROR) << "get op: %s attr failed", op->name.c_str(); + return RET_NULL_PTR; + } + + attr->num = tflite_attr->num; + attr->axis = tflite_attr->axis; + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_Unstack; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteUnstackParser("Unstack", new TfliteUnstackParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_unstack_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_unstack_parser.h new file mode 100644 index 0000000000..82729e7f38 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_unstack_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_UNSTACK_PARSER_H +#define LITE_TFLITE_UNSTACK_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteUnstackParser : public TfliteNodeParser { + public: + TfliteUnstackParser() : TfliteNodeParser("Unstack") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_UNSTACK_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_util.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_util.cc index 7abb158eb6..7da8fb85d9 100644 --- a/mindspore/lite/tools/converter/parser/tflite/tflite_util.cc +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_util.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mindspore/lite/tools/converter/parser/tflite/tflite_util.h" +#include "tools/converter/parser/tflite/tflite_util.h" #include #include #include "utils/log_adapter.h" diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_where_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_where_parser.cc new file mode 100644 index 0000000000..e05e7cb507 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_where_parser.cc @@ -0,0 +1,47 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_where_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteWhereParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteWhereParser"; + std::unique_ptr attr(new schema::WhereT()); + + if (GetTfliteData(tflite_op->inputs[0], tflite_tensors, tflite_model_buffer, attr->condition)) { + MS_LOG(ERROR) << "where -> condition get failed"; + return RET_ERROR; + } + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_Where; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteWhereParser("Where", new TfliteWhereParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_where_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_where_parser.h new file mode 100644 index 0000000000..3a707d0a8b --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_where_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_WHERE_PARSER_H +#define LITE_TFLITE_WHERE_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteWhereParser : public TfliteNodeParser { + public: + TfliteWhereParser() : TfliteNodeParser("Where") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_WHERE_PARSER_H diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_zeros_like_parser.cc b/mindspore/lite/tools/converter/parser/tflite/tflite_zeros_like_parser.cc new file mode 100644 index 0000000000..1393ab5701 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_zeros_like_parser.cc @@ -0,0 +1,43 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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, +* distributed under the License is distributed on an AS +* 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 +#include +#include "tools/converter/parser/tflite/tflite_zeros_like_parser.h" + +namespace mindspore { +namespace lite { +STATUS TfliteZerosLikeParser::Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, + schema::CNodeT *op, + TensorCache *tensor_cache, bool quantized_model) { + MS_LOG(DEBUG) << "parse TfliteZerosLikeParser"; + std::unique_ptr attr(new schema::ZerosLikeT()); + + if (op != nullptr) { + op->primitive = std::make_unique(); + op->primitive->value.type = schema::PrimitiveType_ZerosLike; + op->primitive->value.value = attr.release(); + } + return RET_OK; +} + +TfliteNodeRegister g_tfliteZerosLikeParser("ZerosLike", new TfliteZerosLikeParser()); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/tflite/tflite_zeros_like_parser.h b/mindspore/lite/tools/converter/parser/tflite/tflite_zeros_like_parser.h new file mode 100644 index 0000000000..0c656137d5 --- /dev/null +++ b/mindspore/lite/tools/converter/parser/tflite/tflite_zeros_like_parser.h @@ -0,0 +1,41 @@ +/** +* Copyright 2020 Huawei Technologies Co., Ltd +* +* 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 LITE_TFLITE_ZEROS_LIKE_PARSER_H +#define LITE_TFLITE_ZEROS_LIKE_PARSER_H + +#include +#include +#include "tools/converter/parser/tflite/tflite_node_parser.h" +#include "tools/converter/parser/tflite/tflite_node_parser_registry.h" + +namespace mindspore { +namespace lite { +class TfliteZerosLikeParser : public TfliteNodeParser { + public: + TfliteZerosLikeParser() : TfliteNodeParser("ZerosLike") {} + + STATUS Parse(const std::unique_ptr &tflite_op, + const std::vector> &tflite_tensors, + const std::vector> &tflite_model_buffer, + const std::vector> &tflite_opset, schema::CNodeT *op, + TensorCache *tensor_cache, + bool quantized_model) override; +}; +} // namespace lite +} // namespace mindspore + +#endif // LITE_TFLITE_ZEROS_LIKE_PARSER_H