* 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.
*/
#ifndef MINDSPORE_LITE_INCLUDE_REGISTRY_NODE_PARSER_H_
#define MINDSPORE_LITE_INCLUDE_REGISTRY_NODE_PARSER_H_
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "include/registry/converter_context.h"
namespace onnx {
class GraphProto;
class NodeProto;
}
namespace caffe {
class LayerParameter;
}
namespace tensorflow {
class NodeDef;
}
namespace tflite {
struct OperatorT;
struct SubGraphT;
struct ModelT;
}
namespace mindspore {
namespace ops {
class PrimitiveC;
}
namespace converter {
class MS_API NodeParser {
public:
NodeParser() = default;
virtual ~NodeParser() = default;
virtual ops::PrimitiveC *Parse(const onnx::GraphProto &onnx_graph, const onnx::NodeProto &onnx_node) {
return nullptr;
}
virtual ops::PrimitiveC *Parse(const caffe::LayerParameter &proto, const caffe::LayerParameter &weight) {
return nullptr;
}
virtual ops::PrimitiveC *Parse(const tensorflow::NodeDef &tf_op,
const std::map<std::string, const tensorflow::NodeDef *> &tf_node_map,
std::vector<std::string> *inputs, int *output_size) {
return nullptr;
}
virtual ops::PrimitiveC *Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::unique_ptr<tflite::SubGraphT> &tflite_subgraph,
const std::unique_ptr<tflite::ModelT> &tflite_model) {
return nullptr;
}
};
using NodeParserPtr = std::shared_ptr<NodeParser>;
}
}
#endif