diff --git a/mindspore/lite/test/CMakeLists.txt b/mindspore/lite/test/CMakeLists.txt index 27bbcd6f0f..3ba3378cd2 100644 --- a/mindspore/lite/test/CMakeLists.txt +++ b/mindspore/lite/test/CMakeLists.txt @@ -121,8 +121,7 @@ endif() add_definitions(-DENABLE_V0) file(GLOB_RECURSE OPS_SRC ${LITE_DIR}/src/ops/*.cc) if(ENABLE_CONVERTER) - file(GLOB_RECURSE CONVERTER_OPS_SRC ${CONVERTER_DIR}/ops/*.cc) - set(OPS_SRC ${OPS_SRC} ${CONVERTER_OPS_SRC}) + set(OPS_SRC ${OPS_SRC}) endif() set(TEST_LITE_SRC ${TEST_LITE_SRC} diff --git a/mindspore/lite/tools/converter/CMakeLists.txt b/mindspore/lite/tools/converter/CMakeLists.txt index 3420b057c3..ec37eaa9f6 100644 --- a/mindspore/lite/tools/converter/CMakeLists.txt +++ b/mindspore/lite/tools/converter/CMakeLists.txt @@ -12,8 +12,6 @@ include(${TOP_DIR}/cmake/external_libs/glog.cmake) file(GLOB OPS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../src/ops/*.cc ${CMAKE_CURRENT_SOURCE_DIR}/../../src/ops/populate/*.cc) -file(GLOB CONVERTER_OPS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/ops/*.cc) - file(GLOB_RECURSE CONVERTER_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../flag/flag_parser.cc ${CMAKE_CURRENT_SOURCE_DIR}/converter.cc @@ -145,7 +143,6 @@ ms_build_flatbuffers_lite(TFLITE_FBS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/parser/tf set_property(SOURCE ${CONVERTER_SRC} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE) set_property(SOURCE ${CCSRC_SRC} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE) set_property(SOURCE ${OPS_SRC} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE) -set_property(SOURCE ${CONVERTER_OPS_SRC} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE) set_property(SOURCE ${KERNEL_SRC} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE) set_property(SOURCE ${LITE_SRC} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE) add_executable(converter_lite @@ -153,7 +150,6 @@ add_executable(converter_lite ${CCSRC_SRC} ${CONVERTER_SRC} ${OPS_SRC} - ${CONVERTER_OPS_SRC} ${KERNEL_SRC} ${LITE_SRC} ) diff --git a/mindspore/lite/tools/converter/ops/enter.cc b/mindspore/lite/tools/converter/ops/enter.cc deleted file mode 100644 index 3b74170042..0000000000 --- a/mindspore/lite/tools/converter/ops/enter.cc +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright 2021 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. - */ - -#include "tools/converter/ops/enter.h" -#include "src/tensorlist.h" - -namespace mindspore { -namespace lite { - -int Enter::InferShape(std::vector inputs_, std::vector outputs_) { - if (!infer_flag()) { - return RET_INFER_INVALID; - } - for (size_t i = 0; i < inputs_.size(); i++) { - auto *input = inputs_[i]; - auto *output = outputs_[i]; - if (input == nullptr) { - MS_LOG(ERROR) << "input tensor is nullptr"; - return RET_ERROR; - } - if (output == nullptr) { - MS_LOG(ERROR) << "output tensor is nullptr"; - return RET_ERROR; - } - output->set_data_type(input->data_type()); - output->set_shape(input->shape()); - output->set_format(input->format()); - auto data_type = input->data_type(); - if (data_type != kObjectTypeTensorType) { - continue; - } else { - auto input_tensorlist = reinterpret_cast(input); - auto output_tensorlist = reinterpret_cast(output); - output_tensorlist->set_element_shape(input_tensorlist->element_shape()); - output_tensorlist->set_max_elements_num(input_tensorlist->max_elements_num()); - output_tensorlist->set_tensors_data_type(input_tensorlist->tensors_data_type()); - } - } - return RET_OK; -} - -} // namespace lite -} // namespace mindspore diff --git a/mindspore/lite/tools/converter/ops/enter.h b/mindspore/lite/tools/converter/ops/enter.h index 21f7baa7f2..6a7d58749a 100644 --- a/mindspore/lite/tools/converter/ops/enter.h +++ b/mindspore/lite/tools/converter/ops/enter.h @@ -31,7 +31,6 @@ class Enter : public PrimitiveC { ~Enter() = default; MS_DECLARE_PARENT(Enter, PrimitiveC); explicit Enter(schema::PrimitiveT *primitive) : PrimitiveC(primitive) {} - int InferShape(std::vector inputs_, std::vector outputs_) override; }; } // namespace lite } // namespace mindspore diff --git a/mindspore/lite/tools/converter/ops/exit.cc b/mindspore/lite/tools/converter/ops/exit.cc deleted file mode 100644 index 7b6937390f..0000000000 --- a/mindspore/lite/tools/converter/ops/exit.cc +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright 2021 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. - */ - -#include "tools/converter/ops/exit.h" -#include "src/tensorlist.h" - -namespace mindspore { -namespace lite { - -int Exit::InferShape(std::vector inputs_, std::vector outputs_) { - if (!infer_flag()) { - return RET_INFER_INVALID; - } - for (size_t i = 0; i < inputs_.size(); i++) { - auto *input = inputs_[i]; - auto *output = outputs_[i]; - if (input == nullptr) { - MS_LOG(ERROR) << "input tensor is nullptr"; - return RET_ERROR; - } - if (output == nullptr) { - MS_LOG(ERROR) << "output tensor is nullptr"; - return RET_ERROR; - } - output->set_data_type(input->data_type()); - output->set_shape(input->shape()); - output->set_format(input->format()); - auto data_type = input->data_type(); - if (data_type != kObjectTypeTensorType) { - continue; - } else { - auto input_tensorlist = reinterpret_cast(input); - auto output_tensorlist = reinterpret_cast(output); - output_tensorlist->set_element_shape(input_tensorlist->element_shape()); - output_tensorlist->set_max_elements_num(input_tensorlist->max_elements_num()); - output_tensorlist->set_tensors_data_type(input_tensorlist->tensors_data_type()); - } - } - return RET_OK; -} - -} // namespace lite -} // namespace mindspore diff --git a/mindspore/lite/tools/converter/ops/exit.h b/mindspore/lite/tools/converter/ops/exit.h index 69db67a8c0..1b0b497ccc 100644 --- a/mindspore/lite/tools/converter/ops/exit.h +++ b/mindspore/lite/tools/converter/ops/exit.h @@ -31,7 +31,6 @@ class Exit : public PrimitiveC { ~Exit() = default; MS_DECLARE_PARENT(Exit, PrimitiveC); explicit Exit(schema::PrimitiveT *primitive) : PrimitiveC(primitive) {} - int InferShape(std::vector inputs_, std::vector outputs_) override; }; } // namespace lite } // namespace mindspore diff --git a/mindspore/lite/tools/converter/ops/loop_cond.cc b/mindspore/lite/tools/converter/ops/loop_cond.cc deleted file mode 100644 index 3803af5fcc..0000000000 --- a/mindspore/lite/tools/converter/ops/loop_cond.cc +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright 2021 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. - */ - -#include "tools/converter/ops/loop_cond.h" -#include "src/tensorlist.h" - -namespace mindspore { -namespace lite { - -int LoopCond::InferShape(std::vector inputs_, std::vector outputs_) { - if (!infer_flag()) { - return RET_INFER_INVALID; - } - for (size_t i = 0; i < inputs_.size(); i++) { - auto *input = inputs_[i]; - auto *output = outputs_[i]; - if (input == nullptr) { - MS_LOG(ERROR) << "input tensor is nullptr"; - return RET_ERROR; - } - if (output == nullptr) { - MS_LOG(ERROR) << "output tensor is nullptr"; - return RET_ERROR; - } - output->set_data_type(input->data_type()); - output->set_shape(input->shape()); - output->set_format(input->format()); - auto data_type = input->data_type(); - if (data_type != kObjectTypeTensorType) { - continue; - } else { - auto input_tensorlist = reinterpret_cast(input); - auto output_tensorlist = reinterpret_cast(output); - output_tensorlist->set_element_shape(input_tensorlist->element_shape()); - output_tensorlist->set_max_elements_num(input_tensorlist->max_elements_num()); - output_tensorlist->set_tensors_data_type(input_tensorlist->tensors_data_type()); - } - } - return RET_OK; -} - -} // namespace lite -} // namespace mindspore diff --git a/mindspore/lite/tools/converter/ops/loop_cond.h b/mindspore/lite/tools/converter/ops/loop_cond.h index 12eb6824b0..9ac8617cd3 100644 --- a/mindspore/lite/tools/converter/ops/loop_cond.h +++ b/mindspore/lite/tools/converter/ops/loop_cond.h @@ -31,7 +31,6 @@ class LoopCond : public PrimitiveC { ~LoopCond() = default; MS_DECLARE_PARENT(LoopCond, PrimitiveC); explicit LoopCond(schema::PrimitiveT *primitive) : PrimitiveC(primitive) {} - int InferShape(std::vector inputs_, std::vector outputs_) override; }; } // namespace lite } // namespace mindspore diff --git a/mindspore/lite/tools/converter/ops/next_iteration.cc b/mindspore/lite/tools/converter/ops/next_iteration.cc deleted file mode 100644 index 6b554e39b5..0000000000 --- a/mindspore/lite/tools/converter/ops/next_iteration.cc +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright 2021 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. - */ - -#include "tools/converter/ops/next_iteration.h" -#include "src/tensorlist.h" - -namespace mindspore { -namespace lite { - -int NextIteration::InferShape(std::vector inputs_, std::vector outputs_) { - if (!infer_flag()) { - return RET_INFER_INVALID; - } - for (size_t i = 0; i < inputs_.size(); i++) { - auto *input = inputs_[i]; - auto *output = outputs_[i]; - if (input == nullptr) { - MS_LOG(ERROR) << "input tensor is nullptr"; - return RET_ERROR; - } - if (output == nullptr) { - MS_LOG(ERROR) << "output tensor is nullptr"; - return RET_ERROR; - } - output->set_data_type(input->data_type()); - output->set_shape(input->shape()); - output->set_format(input->format()); - auto data_type = input->data_type(); - if (data_type != kObjectTypeTensorType) { - continue; - } else { - auto input_tensorlist = reinterpret_cast(input); - auto output_tensorlist = reinterpret_cast(output); - output_tensorlist->set_element_shape(input_tensorlist->element_shape()); - output_tensorlist->set_max_elements_num(input_tensorlist->max_elements_num()); - output_tensorlist->set_tensors_data_type(input_tensorlist->tensors_data_type()); - } - } - return RET_OK; -} - -} // namespace lite -} // namespace mindspore diff --git a/mindspore/lite/tools/converter/ops/next_iteration.h b/mindspore/lite/tools/converter/ops/next_iteration.h index 56d8b66767..dc9ec18656 100644 --- a/mindspore/lite/tools/converter/ops/next_iteration.h +++ b/mindspore/lite/tools/converter/ops/next_iteration.h @@ -31,7 +31,6 @@ class NextIteration : public PrimitiveC { ~NextIteration() = default; MS_DECLARE_PARENT(NextIteration, PrimitiveC); explicit NextIteration(schema::PrimitiveT *primitive) : PrimitiveC(primitive) {} - int InferShape(std::vector inputs_, std::vector outputs_) override; }; } // namespace lite } // namespace mindspore