1 // Copyright (C) 2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
7 #include <ie_parameter.hpp>
8 #include <ie_builders.hpp>
14 namespace InferenceEngine {
20 class INFERENCE_ENGINE_API_CLASS(Port) {
22 Port(Builder::Network& network, PortInfo port, bool isInput);
23 PortData::Ptr getData() const;
24 const std::map<std::string, Parameter>& getParameters() const;
25 Layer getLayer() const;
26 Connection getConnection() const;
27 void connect(const Port& port);
29 const SizeVector& shape() const;
30 PortInfo getPortInfo() const;
31 bool operator==(const Port& rObj) const;
32 bool operator!=(const Port& rObj) const;
35 Builder::Network& network;
39 friend class Connection;
42 class INFERENCE_ENGINE_API_CLASS(Layer) {
44 Layer(Builder::Network& network, idx_t id);
45 Port getInPort() const;
46 Port getInPort(idx_t idx) const;
47 std::vector<Port> getInPorts() const;
48 Port getOutPort() const;
49 Port getOutPort(idx_t idx) const;
50 std::vector<Port> getOutPorts() const;
52 void setParameter(const std::string& key, const Parameter& value);
53 Parameter& getParameter(const std::string& value) const;
56 std::string getName() const;
57 std::string getType() const;
58 operator Builder::Layer::Ptr() const;
61 Builder::Network& network;
64 Builder::Layer::Ptr getLayer() const;
67 class INFERENCE_ENGINE_API_CLASS(Connection) {
69 explicit Connection(const Port& port);
70 Connection(Builder::Network& network, const InferenceEngine::Connection& connection);
71 Connection(Builder::Network& network, const PortInfo& inPort, const PortInfo& outPort);
72 Connection(Builder::Network& network, const PortInfo& inPort, const std::vector<PortInfo>& outPorts);
74 Port getSource() const;
75 void setSource(const Port& port);
76 Port getDestination() const;
77 Port getDestination(idx_t idx);
78 std::vector<Port> getDestinations() const;
79 void addDestination(const Port& port);
80 void setDestination(const Port& port);
81 void setDestinations(const std::vector<Port>& ports);
85 Builder::Network& network;
87 std::vector<PortInfo> outPorts;
89 bool inPortExist() const;
92 class INFERENCE_ENGINE_API_CLASS(Network) {
94 explicit Network(Builder::Network& network): network(network) {}
95 virtual ~Network() = default;
97 Layer addLayer(const Builder::Layer& layer);
98 void removeLayer(const Layer& layer);
99 Layer getLayer(const std::string& name) const;
100 Layer getLayer(idx_t id) const;
102 Builder::Network& getBuilderNetwork() const;
104 Connection connect(const Layer& src, const Layer& dst);
105 Connection connect(const Port& src, const Port& dst);
106 void disconnect(const Layer& src, const Layer& dst);
107 void disconnect(const Port& src, const Port& dst);
108 Connection getConnection(const Layer& src, const Layer& dst) const;
109 Connection getConnection(const Port& src, const Port& dst) const;
112 Builder::Network& network;
115 } // namespace Transform
116 } // namespace InferenceEngine