set(NNC_CAFFE_FRONTEND_DIR ${CMAKE_CURRENT_SOURCE_DIR}/passes/caffe_frontend)
set(NNC_CAFFE2_FRONTEND_DIR ${CMAKE_CURRENT_SOURCE_DIR}/passes/caffe2_frontend)
set(NNC_TFLITE_FRONTEND_DIR ${CMAKE_CURRENT_SOURCE_DIR}/passes/tflite_frontend)
+set(NNC_ONNX_FRONTEND_DIR ${CMAKE_CURRENT_SOURCE_DIR}/passes/onnx_frontend)
set(NNC_CORE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/core)
set(NNC_SUPPORT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/support)
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef NNCC_ONNXFRONTEND_H
-#define NNCC_ONNXFRONTEND_H
-
-#include "pass/Pass.h"
-#include "pass/PassData.h"
-
-
-namespace nnc {
-/**
- * @brief class represent frontend of ONNX NN framework
- */
-class ONNXImporter : public Pass
-{
-public:
- ONNXImporter() = default;
- ~ONNXImporter() override = default;
- PassData run(PassData data) override;
-};
-} // namespace nnc
-
-#endif //NNCC_ONNXFRONTEND_H
set_target_properties(nn_import_common PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(nn_import_common PRIVATE nnc_core nnc_support)
+#
# This library depends on other frontends to provide uniform interface for those who use frontends
+#
set(IMPORTER_SUPPORT_SOURCES NNImporter.cpp)
add_nnc_library(nn_importer_support STATIC ${IMPORTER_SUPPORT_SOURCES})
-target_include_directories(nn_importer_support PRIVATE ${NNC_CAFFE_FRONTEND_DIR} ${NNC_CAFFE2_FRONTEND_DIR} ${NNC_TFLITE_FRONTEND_DIR})
-target_link_libraries(nn_importer_support caffe_importer caffe2_importer tflite_importer)
+target_include_directories(nn_importer_support PRIVATE ${NNC_CAFFE_FRONTEND_DIR}
+ ${NNC_CAFFE2_FRONTEND_DIR} ${NNC_TFLITE_FRONTEND_DIR} ${NNC_ONNX_FRONTEND_DIR})
+if (NNC_FRONTEND_CAFFE_ENABLED)
+ target_link_libraries(nn_importer_support caffe_importer)
+endif()
+if (NNC_FRONTEND_CAFFE2_ENABLED)
+ target_link_libraries(nn_importer_support caffe2_importer)
+endif()
+if (NNC_FRONTEND_TFLITE_ENABLED)
+ target_link_libraries(nn_importer_support tflite_importer)
+endif()
+if (NNC_FRONTEND_ONNX_ENABLED)
+ target_link_libraries(nn_importer_support onnx_importer)
+endif()
#include "option/Options.h"
#include "passes/common_frontend/NNImporter.h"
-#include "tflite_importer.h"
-#include "caffe_importer.h"
-#include "caffe2_importer.h"
+#ifdef NNC_FRONTEND_TFLITE_ENABLED
+# include "tflite_importer.h"
+#endif // NNC_FRONTEND_TFLITE_ENABLED
+#ifdef NNC_FRONTEND_CAFFE_ENABLED
+# include "caffe_importer.h"
+#endif // NNC_FRONTEND_CAFFE_ENABLED
+#ifdef NNC_FRONTEND_CAFFE2_ENABLED
+# include "caffe2_importer.h"
+#endif // NNC_FRONTEND_CAFFE2_ENABLED
+#ifdef NNC_FRONTEND_ONNX_ENABLED
+# include "ONNXImporterImpl.h"
+#endif // NNC_FRONTEND_ONNX_ENABLED
namespace nnc {
#endif // NNC_FRONTEND_CAFFE2_ENABLED
} else if (cli::onnxFrontend) {
#ifdef NNC_FRONTEND_ONNX_ENABLED
- importer.reset(new ONNXImporter());
+ importer.reset(new ONNXImporterImpl(cli::inputFile));
#endif // NNC_FRONTEND_ONNX_ENABLED
} else if (cli::tflFrontend) {
#ifdef NNC_FRONTEND_TFLITE_ENABLED
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "option/Options.h"
-#include "passes/onnx_frontend/ONNXImporter.h"
-#include "ONNXImporterImpl.h"
-
-namespace nnc {
-PassData ONNXImporter::run(PassData data) {
- ONNXImporterImpl importer{cli::inputFile};
- return importer.createIR();
-}
-} // namespace nnc
#include "core/modelIR/Graph.h"
#include "ONNXOpType.h"
#include "ONNXOpCreator.h"
-#include "passes/common_frontend/nn_importer.h"
+#include "passes/common_frontend/NNImporter.h"
namespace nnc {