Tests that the optimization performed by PermuteAndBatchToSpaceAsDepthToSpace is as expected. Note this does not ensure the correctness of the optimization - that is done in the below test.
59 Graph graph =
static_cast<Network*
>(network.get())->GetGraph();
62 BOOST_TEST(
CheckSequence(graph.
cbegin(), graph.
cend(), &IsLayerOfType<InputLayer>, &IsLayerOfType<PermuteLayer>,
63 &IsLayerOfType<BatchToSpaceNdLayer>, &IsLayerOfType<OutputLayer>));
69 auto checkDepthToSpace = [](
const Layer*
const layer) ->
bool {
70 return IsLayerOfType<DepthToSpaceLayer>(layer) &&
71 static_cast<const DepthToSpaceLayer*>(layer)->GetParameters().m_BlockSize == 2 &&
72 static_cast<const DepthToSpaceLayer*
>(layer)->GetParameters().m_DataLayout == DataLayout::NHWC &&
77 &IsLayerOfType<OutputLayer>));
80 std::list<std::string> testRelatedLayers = {
"batchToSpace",
"permute" };
81 BOOST_TEST(CheckRelatedLayers<DepthToSpaceLayer>(graph, testRelatedLayers));
const OutputHandler & GetOutputHandler(unsigned int i=0) const
This layer represents a DepthToSpace operation.
OptimizeForConnection< PermuteLayer, BatchToSpaceNdLayer, PermuteAndBatchToSpaceAsDepthToSpaceImpl > PermuteAndBatchToSpaceAsDepthToSpace
static void Pass(Graph &graph, const Optimizations &optimizations)
const TensorInfo & GetTensorInfo() const
Gets the matching TensorInfo for the output.
bool CheckSequence(const armnn::Graph::ConstIterator first, const armnn::Graph::ConstIterator last)
Private implementation of INetwork.
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
ConstIterator cbegin() const
Returns const iterator pointing to the beginning of the list. Lowercase for range-based for loops...
Optimizer::Optimizations MakeOptimizations(Args &&... args)
ConstIterator cend() const
Returns const iterator pointing to the end of the list. Lowercase for range-based for loops...