1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
11 #include "ie_layer_validators.hpp"
13 namespace InferenceEngine {
14 namespace ShapeInfer {
18 * @class IConstInferImpl
19 * @brief This class provides interface for the layer's implementation to propagate const
21 class IConstInferImpl {
23 using Ptr = std::shared_ptr<IConstInferImpl>;
25 virtual ~IConstInferImpl() = default;
29 * @brief all shapes are valid, blobs are allocated
32 virtual void infer(const std::vector<Blob::CPtr>& inData,
33 const std::map<std::string, std::string>& params,
34 const std::map<std::string, Blob::Ptr>& blobs,
35 std::vector<Blob::Ptr>& outData) = 0;
38 class ConstInferImpl : public IConstInferImpl {
40 explicit ConstInferImpl(const std::string& type) : _type(type) {
41 _validator = details::LayerValidators::getInstance()->getValidator(_type);
43 THROW_IE_EXCEPTION << "Internal error: failed to find validator for layer with type: " << _type;
46 virtual void inferImpl(const std::vector<Blob::CPtr>& inData,
47 const std::map<std::string, std::string>& params,
48 const std::map<std::string, Blob::Ptr>& blobs,
49 std::vector<Blob::Ptr>& outData) = 0;
51 void infer(const std::vector<Blob::CPtr>& inData,
52 const std::map<std::string, std::string>& params,
53 const std::map<std::string, Blob::Ptr>& blobs,
54 std::vector<Blob::Ptr>& outData) override;
58 // to get parsed descendant CNNLayer from map<string,string>
59 details::LayerValidator::Ptr _validator;
62 } // namespace ShapeInfer
63 } // namespace InferenceEngine