24.02
|
The SubgraphView class represents a subgraph of a Graph. More...
#include <SubgraphView.hpp>
Public Types | |
using | SubgraphViewPtr = std::shared_ptr< SubgraphView > |
using | InputSlots = std::vector< InputSlot * > |
using | IInputSlots = std::vector< IInputSlot * > |
using | OutputSlots = std::vector< OutputSlot * > |
using | IOutputSlots = std::vector< IOutputSlot * > |
using | Layers = std::list< Layer * > |
using | IConnectableLayers = std::list< IConnectableLayer * > |
using | Iterator = Layers::iterator |
using | IConnectableLayerIterator = IConnectableLayers::iterator |
using | ConstIterator = Layers::const_iterator |
using | ConstIConnectableIterator = IConnectableLayers::const_iterator |
Public Member Functions | |
template<typename Func > | |
void | ForEachLayer (Func func) const |
template<typename Func > | |
void | ForEachIConnectableLayer (Func func) const |
SubgraphView (Graph &graph) | |
Constructs a sub-graph from the entire given graph. More... | |
ARMNN_DEPRECATED_MSG_REMOVAL_DATE ("This function has been deprecated, please use constructor with arguments: " "IConnectableLayers, IInputSlots and IOutputSlots", "23.08") SubgraphView(InputSlots &&inputs | |
Constructs a sub-graph with the given arguments. More... | |
SubgraphView (IConnectableLayers &&layers, IInputSlots &&inputs, IOutputSlots &&outputs) | |
Constructs a sub-graph with the given arguments. More... | |
SubgraphView (const SubgraphView &subgraph) | |
Copy-constructor. More... | |
SubgraphView (SubgraphView &&subgraph) | |
Move-constructor. More... | |
SubgraphView (IConnectableLayer *layer) | |
Constructs a sub-graph with only the given layer. More... | |
SubgraphView & | operator= (SubgraphView &&other) |
Move-assignment operator. More... | |
const IInputSlots & | GetIInputSlots () const |
const IOutputSlots & | GetIOutputSlots () const |
const IConnectableLayers & | GetIConnectableLayers () const |
const IInputSlot * | GetIInputSlot (unsigned int index) const |
IInputSlot * | GetIInputSlot (unsigned int index) |
const IOutputSlot * | GetIOutputSlot (unsigned int index) const |
OutputSlot * | GetOutputSlot (unsigned int index) |
IOutputSlot * | GetIOutputSlot (unsigned int index) |
unsigned int | GetNumInputSlots () const |
unsigned int | GetNumOutputSlots () const |
IConnectableLayerIterator | begin () |
ARMNN_DEPRECATED_MSG_CHANGE_DATE ("This function is deprecated and will be removed; please use " "begin() returning public IConnectableIterator", "24.05") IConnectableLayerIterator beginIConnectable() | |
IConnectableLayerIterator | end () |
ARMNN_DEPRECATED_MSG_CHANGE_DATE ("This function is deprecated and will be removed; please use " "end() returning public IConnectableLayerIterator", "24.05") IConnectableLayerIterator endIConnectable() | |
ConstIConnectableIterator | begin () const |
ARMNN_DEPRECATED_MSG_CHANGE_DATE ("This function is deprecated and will be removed; please use " "begin() returning public ConstIConnectableIterator", "24.05") ConstIConnectableIterator beginIConnectable() const | |
ConstIConnectableIterator | end () const |
ARMNN_DEPRECATED_MSG_CHANGE_DATE ("This function is deprecated and will be removed; please use " "end() returning public ConstIConnectableIterator", "24.05") ConstIConnectableIterator endIConnectable() const | |
ConstIConnectableIterator | cbegin () const |
ARMNN_DEPRECATED_MSG_CHANGE_DATE ("This function is deprecated and will be removed; please use " "cbegin() returning public ConstIterator", "24.05") ConstIConnectableIterator cbeginIConnectable() const | |
ConstIConnectableIterator | cend () const |
ARMNN_DEPRECATED_MSG_CHANGE_DATE ("This function is deprecated and will be removed; please use " "cend() returning public ConstIConnectableIterator", "24.05") ConstIConnectableIterator cendIConnectable() const | |
void | Clear () |
SubgraphView | GetWorkingCopy () const |
This method returns a copy of the original SubgraphView provided by OptimizeSubgraphView with a separate underlying graph from the main ArmNN graph. More... | |
void | SubstituteSubgraph (SubgraphView &, IConnectableLayer *) |
These methods should be called on a working copy subgraph created from GetWorkingCopy. More... | |
void | SubstituteSubgraph (SubgraphView &, const SubgraphView &) |
const IInputSlots & | GetOriginalInputSlots () const |
These methods should be called on a working copy subgraph created from GetWorkingCopy. More... | |
const IOutputSlots & | GetOriginalOutputSlots () const |
Public Attributes | |
OutputSlots && | outputs |
OutputSlots Layers && | layers |
The SubgraphView class represents a subgraph of a Graph.
The data it holds, points to data held by layers of the Graph, so the the contents of the SubgraphView become invalid when the Layers are destroyed or changed.
Definition at line 31 of file SubgraphView.hpp.
using ConstIConnectableIterator = IConnectableLayers::const_iterator |
Definition at line 66 of file SubgraphView.hpp.
using ConstIterator = Layers::const_iterator |
Definition at line 65 of file SubgraphView.hpp.
using IConnectableLayerIterator = IConnectableLayers::iterator |
Definition at line 64 of file SubgraphView.hpp.
using IConnectableLayers = std::list<IConnectableLayer*> |
Definition at line 62 of file SubgraphView.hpp.
using IInputSlots = std::vector<IInputSlot*> |
Definition at line 58 of file SubgraphView.hpp.
using InputSlots = std::vector<InputSlot*> |
Definition at line 57 of file SubgraphView.hpp.
using IOutputSlots = std::vector<IOutputSlot*> |
Definition at line 60 of file SubgraphView.hpp.
using Iterator = Layers::iterator |
Definition at line 63 of file SubgraphView.hpp.
Definition at line 61 of file SubgraphView.hpp.
using OutputSlots = std::vector<OutputSlot*> |
Definition at line 59 of file SubgraphView.hpp.
using SubgraphViewPtr = std::shared_ptr<SubgraphView> |
Definition at line 56 of file SubgraphView.hpp.
|
explicit |
Constructs a sub-graph from the entire given graph.
Definition at line 45 of file SubgraphView.cpp.
SubgraphView | ( | SubgraphView::IConnectableLayers && | layers, |
SubgraphView::IInputSlots && | inputs, | ||
SubgraphView::IOutputSlots && | outputs | ||
) |
Constructs a sub-graph with the given arguments.
IConnectable Duplication to maintain backwards compatibility.
Definition at line 71 of file SubgraphView.cpp.
SubgraphView | ( | const SubgraphView & | subgraph | ) |
SubgraphView | ( | SubgraphView && | subgraph | ) |
SubgraphView | ( | IConnectableLayer * | layer | ) |
ARMNN_DEPRECATED_MSG_CHANGE_DATE | ( | "This function is deprecated and will be removed; please use " "begin() returning public ConstIConnectableIterator" | , |
"24.05" | |||
) | const |
ARMNN_DEPRECATED_MSG_CHANGE_DATE | ( | "This function is deprecated and will be removed; please use " "begin() returning public IConnectableIterator" | , |
"24.05" | |||
) |
ARMNN_DEPRECATED_MSG_CHANGE_DATE | ( | "This function is deprecated and will be removed; please use " "cbegin() returning public ConstIterator" | , |
"24.05" | |||
) | const |
ARMNN_DEPRECATED_MSG_CHANGE_DATE | ( | "This function is deprecated and will be removed; please use " "cend() returning public ConstIConnectableIterator" | , |
"24.05" | |||
) | const |
ARMNN_DEPRECATED_MSG_CHANGE_DATE | ( | "This function is deprecated and will be removed; please use " "end() returning public ConstIConnectableIterator" | , |
"24.05" | |||
) | const |
ARMNN_DEPRECATED_MSG_CHANGE_DATE | ( | "This function is deprecated and will be removed; please use " "end() returning public IConnectableLayerIterator" | , |
"24.05" | |||
) |
ARMNN_DEPRECATED_MSG_REMOVAL_DATE | ( | "This function has been | deprecated, |
please use constructor with arguments:" " | IConnectableLayers, | ||
IInputSlots and IOutputSlots" | , | ||
"23.08" | |||
) | && |
Constructs a sub-graph with the given arguments.
SubgraphView::ConstIConnectableIterator begin | ( | ) |
Definition at line 283 of file SubgraphView.cpp.
Referenced by armnn::AssignBackends(), SubgraphView::cbegin(), TosaRefBackend::OptimizeSubgraphView(), RefBackend::OptimizeSubgraphView(), NeonBackend::OptimizeSubgraphView(), ClBackend::OptimizeSubgraphView(), and GpuFsaBackend::OptimizeSubgraphView().
ConstIConnectableIterator begin | ( | ) | const |
SubgraphView::ConstIConnectableIterator cbegin | ( | ) | const |
Definition at line 325 of file SubgraphView.cpp.
References SubgraphView::begin().
SubgraphView::ConstIConnectableIterator cend | ( | ) | const |
Definition at line 330 of file SubgraphView.cpp.
References SubgraphView::end().
void Clear | ( | ) |
Definition at line 346 of file SubgraphView.cpp.
Definition at line 288 of file SubgraphView.cpp.
Referenced by armnn::AssignBackends(), SubgraphView::cend(), TosaRefBackend::OptimizeSubgraphView(), RefBackend::OptimizeSubgraphView(), NeonBackend::OptimizeSubgraphView(), ClBackend::OptimizeSubgraphView(), and GpuFsaBackend::OptimizeSubgraphView().
ConstIConnectableIterator end | ( | ) | const |
|
inline |
Definition at line 46 of file SubgraphView.hpp.
Referenced by SubgraphView::SubstituteSubgraph(), and Graph::SubstituteSubgraph().
|
inline |
Definition at line 35 of file SubgraphView.hpp.
const SubgraphView::IConnectableLayers & GetIConnectableLayers | ( | ) | const |
Definition at line 278 of file SubgraphView.cpp.
Referenced by armnn::ApplyBackendOptimizations(), SubgraphView::GetWorkingCopy(), SubgraphViewSelector::SelectSubgraphs(), and OptimizationViews::Validate().
IInputSlot * GetIInputSlot | ( | unsigned int | index | ) |
Definition at line 248 of file SubgraphView.cpp.
const IInputSlot * GetIInputSlot | ( | unsigned int | index | ) | const |
Definition at line 243 of file SubgraphView.cpp.
const SubgraphView::IInputSlots & GetIInputSlots | ( | ) | const |
Definition at line 233 of file SubgraphView.cpp.
Referenced by SubgraphView::GetWorkingCopy(), SubgraphViewSelector::SelectSubgraphs(), SubgraphView::SubstituteSubgraph(), and OptimizationViews::Validate().
IOutputSlot * GetIOutputSlot | ( | unsigned int | index | ) |
Definition at line 263 of file SubgraphView.cpp.
const IOutputSlot * GetIOutputSlot | ( | unsigned int | index | ) | const |
Definition at line 253 of file SubgraphView.cpp.
Referenced by TosaRefBackend::OptimizeSubgraphView().
const SubgraphView::IOutputSlots & GetIOutputSlots | ( | ) | const |
Definition at line 238 of file SubgraphView.cpp.
Referenced by SubgraphView::GetWorkingCopy(), SubgraphView::SubstituteSubgraph(), and OptimizationViews::Validate().
unsigned int GetNumInputSlots | ( | ) | const |
Definition at line 268 of file SubgraphView.cpp.
Referenced by TosaRefBackend::OptimizeSubgraphView().
unsigned int GetNumOutputSlots | ( | ) | const |
Definition at line 273 of file SubgraphView.cpp.
Referenced by TosaRefBackend::OptimizeSubgraphView(), and GpuFsaBackend::OptimizeSubgraphView().
const SubgraphView::IInputSlots & GetOriginalInputSlots | ( | ) | const |
These methods should be called on a working copy subgraph created from GetWorkingCopy.
They return pointers to the input and output Slots belonging to the original SubgraphView that the working copy was created from. This may be used to find the original TensorInfo of connected boundary OutputSlots.
Definition at line 602 of file SubgraphView.cpp.
const SubgraphView::IOutputSlots & GetOriginalOutputSlots | ( | ) | const |
Definition at line 615 of file SubgraphView.cpp.
OutputSlot * GetOutputSlot | ( | unsigned int | index | ) |
Definition at line 258 of file SubgraphView.cpp.
SubgraphView GetWorkingCopy | ( | ) | const |
This method returns a copy of the original SubgraphView provided by OptimizeSubgraphView with a separate underlying graph from the main ArmNN graph.
Backend users should edit this working copy and then add it as a SubstitutionPair, along with original SubgraphView, to the OptimizationViews returned by OptimizeSubgraphView. ArmNN will then decide on whether or not to carry out Substitution of the two SubgraphViews.
Definition at line 393 of file SubgraphView.cpp.
References Layer::Clone(), SubgraphView::GetIConnectableLayers(), SubgraphView::GetIInputSlots(), SubgraphView::GetIOutputSlots(), IConnectableLayer::GetNumOutputSlots(), IConnectableLayer::GetOutputSlot(), IConnectableLayer::GetType(), armnn::Output, and IInputSlot::SetTensorInfo().
SubgraphView & operator= | ( | SubgraphView && | other | ) |
void SubstituteSubgraph | ( | SubgraphView & | patternSubgraph, |
const SubgraphView & | substituteSubgraph | ||
) |
Definition at line 536 of file SubgraphView.cpp.
References SubgraphView::ForEachIConnectableLayer(), SubgraphView::GetIInputSlots(), and SubgraphView::GetIOutputSlots().
void SubstituteSubgraph | ( | SubgraphView & | subgraph, |
IConnectableLayer * | substituteLayer | ||
) |
These methods should be called on a working copy subgraph created from GetWorkingCopy.
They take a SubgraphView pattern to replace and the substitute layer or subgraphView to substitute in.
Definition at line 494 of file SubgraphView.cpp.
References ARMNN_ASSERT.
OutputSlots Layers&& layers |
Definition at line 74 of file SubgraphView.hpp.
OutputSlots&& outputs |
Definition at line 74 of file SubgraphView.hpp.