target_link_libraries(caffe_importer PUBLIC caffeproto)
target_link_libraries(caffe_importer PUBLIC ${nn_import_common})
+target_link_libraries(caffe_importer PRIVATE nnc_core)
target_link_libraries(caffe_importer PRIVATE nncc_core)
+target_link_libraries(caffe_importer PRIVATE nnc_plugin_core)
--- /dev/null
+#ifndef NNCC_CAFFE_IR_VISITOR_H
+#define NNCC_CAFFE_IR_VISITOR_H
+
+#include <map>
+#include <vector>
+
+#include "nnc/core/IR/model/graph/graph.h"
+#include "nnc/core/IR/model/graph/ir_node.h"
+#include "nnc/core/linalg/TensorVariant.h"
+
+#include "caffe_visitor.h"
+
+namespace nncc
+{
+namespace contrib
+{
+namespace frontend
+{
+namespace caffe
+{
+
+using namespace ::caffe;
+
+using IrTensor = nncc::contrib::core::ADT::TensorVariant;
+using nncc::contrib::core::IR::model::Graph;
+using nncc::contrib::core::IR::model::ADT::INode;
+using nncc::core::ADT::tensor::Shape;
+
+class ModelVisitor : public Visitor
+{
+public:
+ ModelVisitor() : graph(new Graph()) {};
+
+ void visit(const NetParameter&) override;
+ void visit(const LayerParameter&) override;
+ void visit(const BlobProto&) override;
+ void visit(const BlobShape&) override;
+
+ Graph* getGraph();
+
+private:
+ Graph* graph = nullptr;
+
+ std::vector<Shape> inputShapes;
+ std::map<std::string, INode::Ref> opsForBlobsTheyOutput;
+
+ std::shared_ptr<IrTensor> createTensor(const BlobProto&);
+ std::vector<INode::Ref> createOpInputs(const LayerParameter&);
+ std::vector<std::shared_ptr<IrTensor>> createOpParams(const LayerParameter&);
+
+ void createGraphInputs(const std::vector<std::string> &names,
+ const std::vector<Shape> &shapes);
+ void processInputLayer(const LayerParameter&);
+ void processDeprecatedInput(const NetParameter&);
+};
+
+} // namespace caffe
+} // namespace frontend
+} // namespace contrib
+} // namespace nncc
+
+#endif //NNCC_CAFFE_IR_VISITOR_H
--- /dev/null
+#include <vector>
+#include <cassert>
+#include <stdexcept>
+
+#include "nncc/core/ADT/tensor/Shape.h"
+#include "nnc/core/IR/model/operations/variable_op.h"
+
+#include "shape_helper.h"
+#include "caffe_model_visitor.h"
+
+namespace nncc
+{
+namespace contrib
+{
+namespace frontend
+{
+namespace caffe
+{
+
+using VariableOp = nncc::contrib::core::IR::model::ops::VariableOp;
+using nncc::core::ADT::tensor::Shape;
+
+void ModelVisitor::visit(const NetParameter& np)
+{
+ processDeprecatedInput(np);
+}
+
+void ModelVisitor::visit(const LayerParameter& lp)
+{
+ throw std::runtime_error("Not yet implemented");
+}
+
+void ModelVisitor::visit(const BlobProto&) { throw std::runtime_error("Not yet implemented"); }
+void ModelVisitor::visit(const BlobShape&) { throw std::runtime_error("Not yet implemented"); }
+
+Graph *ModelVisitor::getGraph()
+{
+ return graph;
+}
+
+void ModelVisitor::createGraphInputs(const std::vector<std::string> &names,
+ const std::vector<Shape> &shapes)
+{
+ throw std::runtime_error("Not yet implemented");
+}
+
+void ModelVisitor::processDeprecatedInput(const NetParameter& np)
+{
+ throw std::runtime_error("Not yet implemented");
+}
+
+void ModelVisitor::processInputLayer(const LayerParameter& lp)
+{
+ throw std::runtime_error("Not yet implemented");
+}
+
+std::shared_ptr<IrTensor> ModelVisitor::createTensor(const BlobProto &bp)
+{
+ throw std::runtime_error("Not yet implemented");
+}
+
+std::vector<INode::Ref> ModelVisitor::createOpInputs(const LayerParameter &lp)
+{
+ throw std::runtime_error("Not yet implemented");
+}
+
+std::vector<std::shared_ptr<IrTensor>> ModelVisitor::createOpParams(const LayerParameter &lp)
+{
+ throw std::runtime_error("Not yet implemented");
+}
+
+} // namespace caffe
+} // namespace frontend
+} // namespace contrib
+} // namespace nncc