MCPcopy Create free account
hub / github.com/ARM-software/armnn / Pooling3d

Function Pooling3d

src/backends/reference/workloads/Pooling3d.cpp:172–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170namespace armnn
171{
172void Pooling3d(Decoder<float>& rInputDecoder,
173 Encoder<float>& rOutputEncoder,
174 const TensorInfo& inputInfo,
175 const TensorInfo& outputInfo,
176 const Pooling3dDescriptor& params)
177{
178 const DataLayoutIndexed dataLayout(params.m_DataLayout);
179
180 auto channelsIndex = dataLayout.GetChannelsIndex();
181
182 auto depthIndex = dataLayout.GetDepthIndex();
183 auto heightIndex = dataLayout.GetHeightIndex();
184 auto widthIndex = dataLayout.GetWidthIndex();
185
186 const int batchSize = armnn::numeric_cast<int>(outputInfo.GetShape()[0]);
187 const int channels = armnn::numeric_cast<int>(outputInfo.GetShape()[channelsIndex]);
188
189 const int depthOutput = armnn::numeric_cast<int>(outputInfo.GetShape()[depthIndex]);
190 const int heightOutput = armnn::numeric_cast<int>(outputInfo.GetShape()[heightIndex]);
191 const int widthOutput = armnn::numeric_cast<int>(outputInfo.GetShape()[widthIndex]);
192
193 const int depthInput = armnn::numeric_cast<int>(inputInfo.GetShape()[depthIndex]);
194 const int heightInput = armnn::numeric_cast<int>(inputInfo.GetShape()[heightIndex]);
195 const int widthInput = armnn::numeric_cast<int>(inputInfo.GetShape()[widthIndex]);
196
197 const int padLeft = armnn::numeric_cast<int>(params.m_PadLeft);
198 const int padRight = armnn::numeric_cast<int>(params.m_PadRight);
199 const int padTop = armnn::numeric_cast<int>(params.m_PadTop);
200 const int padBottom = armnn::numeric_cast<int>(params.m_PadBottom);
201 const int padFront = armnn::numeric_cast<int>(params.m_PadFront);
202 const int padBack = armnn::numeric_cast<int>(params.m_PadBack);
203
204 const int strideX = armnn::numeric_cast<int>(params.m_StrideX);
205 const int strideY = armnn::numeric_cast<int>(params.m_StrideY);
206 const int strideZ = armnn::numeric_cast<int>(params.m_StrideZ);
207
208 const int poolHeight = armnn::numeric_cast<int>(params.m_PoolHeight);
209 const int poolWidth = armnn::numeric_cast<int>(params.m_PoolWidth);
210 const int poolDepth = armnn::numeric_cast<int>(params.m_PoolDepth);
211
212 float defaultInitializer = DefaultInitializer(params.m_PoolType);
213 Accumulator accumulate = GetAccumulator(params.m_PoolType);
214 Executor execute = GetExecutor(params.m_PoolType);
215
216 // Check supported padding methods outside the loop to simplify
217 // the inner loop.
218 if (params.m_PaddingMethod != PaddingMethod::Exclude &&
219 params.m_PaddingMethod != PaddingMethod::IgnoreValue)
220 {
221 throw armnn::InvalidArgumentException("Unsupported padding type");
222 }
223
224 const std::vector<float> decodedInputVec = rInputDecoder.DecodeTensor(inputInfo.GetShape());
225
226 for (int n = 0; n < batchSize; n++)
227 {
228 for (int c = 0; c < channels; c++)
229 {

Callers 1

ExecuteMethod · 0.85

Calls 14

CalculateIndexFunction · 0.85
GetChannelsIndexMethod · 0.80
GetDepthIndexMethod · 0.80
GetHeightIndexMethod · 0.80
GetWidthIndexMethod · 0.80
DefaultInitializerFunction · 0.70
GetAccumulatorFunction · 0.70
GetExecutorFunction · 0.70
ClampRangeFunction · 0.70
OnPaddingOnlyFunction · 0.70
GetShapeMethod · 0.45

Tested by

no test coverage detected