11 namespace optimizations
17 template <
typename PermuteType>
33 if (!
static_cast<PermuteType&
>(base).GetParameters().m_DimMappings.IsEqual(
PermutationVector{ 3, 1, 2, 0 }))
50 if (batchToSpaceDesc.
m_Crops != std::vector<std::pair<unsigned int, unsigned int>>{ { 0, 0 }, { 0, 0 } })
55 if (batchToSpaceDesc.m_BlockShape.size() != 2 ||
56 batchToSpaceDesc.m_BlockShape[0] != batchToSpaceDesc.m_BlockShape[1])
61 uint32_t blockSize = batchToSpaceDesc.m_BlockShape[0];
62 if (outputInfo.GetShape()[0] != 1 || outputInfo.GetShape()[3] != 1)
74 bool isIntermediateQuantParamsSameAsInput =
75 intermediateInfo.GetQuantizationScale() == inputInfo.GetQuantizationScale() &&
76 intermediateInfo.GetQuantizationOffset() == inputInfo.GetQuantizationOffset();
77 bool isIntermediateQuantParamsSameAsOutput =
78 intermediateInfo.GetQuantizationScale() == outputInfo.GetQuantizationScale() &&
79 intermediateInfo.GetQuantizationOffset() == outputInfo.GetQuantizationOffset();
80 if (!isIntermediateQuantParamsSameAsInput && !isIntermediateQuantParamsSameAsOutput)
86 const std::string name = std::string(
"merged-") + base.
GetName() + std::string(
"-with-") + child.GetName();
90 auto& depthToSpace = *graph.InsertNewLayer<DepthToSpaceLayer>(base.GetInputSlot(0),
97 child.GetOutputSlot().MoveAllConnections(depthToSpace.GetOutputSlot());
#define ARMNN_ASSERT(COND)
This layer represents a BatchToSpaceNd operation.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
const char * GetName() const override
Returns the name of the layer.
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
Layer & GetOwningLayer() const
const TensorInfo & GetTensorInfo() const override
This layer represents a permutation operation.
unsigned int GetNumDimensions() const
This layer represents a transpose operation.
Replaces Permute leading into BatchToSpace with a DepthToSpace in the case where the Permute swaps th...
void Run(Graph &graph, InputSlot &connection) const
Copyright (c) 2021 ARM Limited and Contributors.
SpaceToDepthDescriptor DepthToSpaceDescriptor
A DepthToSpaceDescriptor for the DepthToSpaceLayer.
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
std::vector< std::pair< unsigned int, unsigned int > > m_Crops
The values to crop from the input dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).