22 return static_cast<unsigned int>(m_DimData.size());
25 template <
typename Func,
typename DecoderOp,
typename EncoderOp>
27 unsigned int dimension,
34 outData.Set(operationFunc(inData0.Get(), inData1.Get()));
38 unsigned int inData0Movement = 0;
39 unsigned int inData1Movement = 0;
40 unsigned int outDataMovement = 0;
42 for (
unsigned int i = 0; i < m_DimData[dimension].m_DimSize; i++)
44 Unroll(operationFunc, dimension + 1, inData0, inData1, outData);
46 inData0 += m_DimData[dimension].m_Stride1;
47 inData1 += m_DimData[dimension].m_Stride2;
48 outData += m_DimData[dimension].m_StrideOut;
50 inData0Movement += m_DimData[dimension].m_Stride1;
51 inData1Movement += m_DimData[dimension].m_Stride2;
52 outDataMovement += m_DimData[dimension].m_StrideOut;
56 inData0 -= inData0Movement;
57 inData1 -= inData1Movement;
58 outData -= outDataMovement;
61 template <
typename Func,
typename DecoderOp,
typename EncoderOp>
63 unsigned int dimension,
69 outData.Set(operationFunc(inData.Get()));
73 unsigned int inDataMovement = 0;
74 unsigned int outDataMovement = 0;
76 for (
unsigned int i = 0; i < m_DimData[dimension].m_DimSize; i++)
78 Unroll(operationFunc, dimension + 1, inData, outData);
80 inData += m_DimData[dimension].m_Stride1;
81 outData += m_DimData[dimension].m_StrideOut;
83 inDataMovement += m_DimData[dimension].m_Stride1;
84 outDataMovement += m_DimData[dimension].m_StrideOut;
88 inData -= inDataMovement;
89 outData -= outDataMovement;
94 struct BroadcastDimensionData
96 unsigned int m_DimSize;
97 unsigned int m_StrideOut;
98 unsigned int m_Stride1;
99 unsigned int m_Stride2;
102 std::vector<BroadcastDimensionData> m_DimData;
Copyright (c) 2020 ARM Limited.
BroadcastLoop(const TensorShape &inShape0, const TensorShape &inShape1, const TensorShape &outShape)
void Unroll(Func operationFunc, unsigned int dimension, DecoderOp &inData, EncoderOp &outData)
unsigned int GetNumDimensions()
void Unroll(Func operationFunc, unsigned int dimension, DecoderOp &inData0, DecoderOp &inData1, EncoderOp &outData)