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

Function PadParams

src/backends/reference/workloads/StridedSlice.cpp:18–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16{
17
18void PadParams(StridedSliceDescriptor& p, unsigned int dimCount)
19{
20 ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(dimCount <= 4, "Expected input with at most 4 dimensions");
21
22 const unsigned int beginIndicesCount =
23 armnn::numeric_cast<unsigned int>(p.m_Begin.size());
24
25 const unsigned int padCount = dimCount - beginIndicesCount;
26
27 p.m_Begin.resize(dimCount);
28 p.m_End.resize(dimCount);
29 p.m_Stride.resize(dimCount);
30
31 for (unsigned int i = beginIndicesCount; i > 0; --i)
32 {
33 p.m_Stride[i + padCount - 1] = p.m_Stride[i - 1];
34 p.m_Begin[i + padCount - 1] = p.m_Begin[i - 1];
35 p.m_End[i + padCount - 1] = p.m_End[i - 1];
36 }
37
38 for (unsigned int i = 0; i < padCount; ++i)
39 {
40 p.m_Stride[i] = 1;
41 p.m_Begin[i] = 0;
42 p.m_End[i] = 0;
43 }
44
45 p.m_ShrinkAxisMask <<= padCount;
46 p.m_EllipsisMask <<= padCount;
47 p.m_NewAxisMask <<= padCount;
48 p.m_BeginMask <<= padCount;
49 p.m_EndMask <<= padCount;
50 p.m_BeginMask |= (1 << padCount) - 1;
51 p.m_EndMask |= (1 << padCount) - 1;
52}
53
54bool LoopCondition(int index, int stop, int stride)
55{

Callers 1

StridedSliceFunction · 0.85

Calls 2

resizeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected