54 TEST_CASE(
"OptimizedViewsSubgraphLayerCount")
66 Layer*
const substitutableCompiledLayer =
73 convLayer2->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
89 {substitutableCompiledLayer});
91 Graph substitutableGraph;
92 Layer*
const substitutionpreCompiledLayer =
93 substitutableGraph.AddLayer<
PreCompiledLayer>(substitutionLayerDescriptor,
"pre-compiled");
99 {substitutionpreCompiledLayer});
110 {substitutionpreCompiledLayer});
117 {convLayer1, convLayer2, substitutionpreCompiledLayer});
119 CHECK(view.
Validate(*originalSubgraph));
122 TEST_CASE(
"OptimizedViewsSubgraphLayerCountFailValidate")
134 Layer*
const substitutableCompiledLayer =
141 convLayer2->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
152 {substitutableCompiledLayer});
154 Graph substitutableGraph;
155 Layer*
const substitutionpreCompiledLayer =
156 substitutableGraph.AddLayer<
PreCompiledLayer>(substitutionLayerDescriptor,
"pre-compiled");
162 {substitutionpreCompiledLayer});
172 {substitutionpreCompiledLayer});
179 {convLayer1, convLayer2, substitutionpreCompiledLayer});
182 CHECK(!view.
Validate(*originalSubgraph));
185 TEST_CASE(
"OptimizeViewsValidateDeviceMockBackend")
static IRuntimePtr Create(const CreationOptions &options)
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
LayerT * AddLayer(Args &&... args)
Adds a new layer, of type LayerType, to the graph constructed with the arguments passed.
A Convolution2dDescriptor for the Convolution2dLayer.
int Connect(InputSlot &destination)
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
void CheckLayers(Graph &graph)
void AddSubstitution(SubstitutionPair &&substitution)
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
The SubgraphView class represents a subgraph of a Graph.
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
A layer user-provided data can be bound to (e.g. inputs, outputs).
IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptions &options=OptimizerOptions(), Optional< std::vector< std::string > &> messages=EmptyOptional())
Create an optimized version of the network.
SubgraphView::InputSlots CreateInputsFrom(const std::vector< Layer *> &layers)
static const BackendId & GetIdStatic()
void AddFailedSubgraph(SubgraphView &&subgraph)
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
bool Validate(const SubgraphView &originalSubgraph) const
void AddUntouchedSubgraph(SubgraphView &&subgraph)
void SubstituteSubgraph(SubgraphView &subgraph, IConnectableLayer *substituteLayer)
Substitutes the given sub-graph with either a new layer or a new sub-graph.
Graph & GetGraphForTesting(IOptimizedNetwork *optNet)
std::unique_ptr< SubgraphView > SubgraphViewPtr
SubgraphView::SubgraphViewPtr CreateSubgraphViewFrom(SubgraphView::InputSlots &&inputs, SubgraphView::OutputSlots &&outputs, SubgraphView::Layers &&layers)
SubgraphView::OutputSlots CreateOutputsFrom(const std::vector< Layer *> &layers)
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
Get a const input slot handle by slot index.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
Get the const output slot handle by slot index.
This layer represents a convolution 2d operation.
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
virtual int Connect(IInputSlot &destination)=0
A PreCompiledDescriptor for the PreCompiledLayer.
static INetworkPtr Create(NetworkOptions networkOptions={})