6 #include <boost/test/unit_test.hpp> 16 using namespace armnn;
20 unsigned int m_inputLayerCount = 0, m_outputLayerCount = 0, m_addLayerCount = 0;
21 for(
auto layer : graph)
23 switch(layer->GetType())
27 BOOST_TEST((layer->GetName() == std::string(
"inLayer0") ||
28 layer->GetName() == std::string(
"inLayer1")));
33 BOOST_TEST(layer->GetName() ==
"pre-compiled");
37 BOOST_TEST(layer->GetName() ==
"outLayer");
44 BOOST_TEST(m_inputLayerCount == 2);
45 BOOST_TEST(m_outputLayerCount == 1);
46 BOOST_TEST(m_addLayerCount == 1);
63 Layer*
const substitutableCompiledLayer =
70 convLayer2->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
86 {substitutableCompiledLayer});
88 Graph substitutableGraph;
89 Layer*
const substitutionpreCompiledLayer =
90 substitutableGraph.AddLayer<
PreCompiledLayer>(substitutionLayerDescriptor,
"pre-compiled");
96 {substitutionpreCompiledLayer});
107 {substitutionpreCompiledLayer});
114 {convLayer1, convLayer2, substitutionpreCompiledLayer});
131 Layer*
const substitutableCompiledLayer =
138 convLayer2->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
149 {substitutableCompiledLayer});
151 Graph substitutableGraph;
152 Layer*
const substitutionpreCompiledLayer =
153 substitutableGraph.AddLayer<
PreCompiledLayer>(substitutionLayerDescriptor,
"pre-compiled");
159 {substitutionpreCompiledLayer});
169 {substitutionpreCompiledLayer});
176 {convLayer1, convLayer2, substitutionpreCompiledLayer});
211 OptimizedNetwork* optNetObjPtr = boost::polymorphic_downcast<OptimizedNetwork*>(optNet.get());
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
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)
Copyright (c) 2020 ARM Limited.
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
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
BOOST_AUTO_TEST_CASE(CheckConvolution2dLayer)
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.
std::unique_ptr< SubgraphView > SubgraphViewPtr
BOOST_AUTO_TEST_SUITE_END()
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.
armnn::Runtime::CreationOptions::ExternalProfilingOptions options
static INetworkPtr Create()