#include <Broadcast.hpp>
|
| BroadcastLoop (const TensorShape &inShape0, const TensorShape &inShape1, const TensorShape &outShape) |
|
| BroadcastLoop (const TensorShape &inShape, const TensorShape &outShape) |
|
unsigned int | GetNumDimensions () |
|
template<typename Func , typename DecoderOp , typename EncoderOp > |
void | Unroll (Func operationFunc, unsigned int dimension, DecoderOp &inData0, DecoderOp &inData1, EncoderOp &outData) |
|
template<typename Func , typename DecoderOp , typename EncoderOp > |
void | Unroll (Func operationFunc, unsigned int dimension, DecoderOp &inData, EncoderOp &outData) |
|
Definition at line 14 of file Broadcast.hpp.
◆ BroadcastLoop() [1/2]
Definition at line 11 of file Broadcast.cpp.
12 : m_DimData(outShape.GetNumDimensions())
16 unsigned int sIn0 = 1;
17 unsigned int sIn1 = 1;
18 unsigned int sOut = 1;
20 for (
unsigned int j = numDims - 1, k = 0; k < numDims ; k++, j--)
22 m_DimData[j].m_DimSize = outShape[j];
23 m_DimData[j].m_Stride1 = (inShape0[j] > 1) ? sIn0 : 0;
24 m_DimData[j].m_Stride2 = (inShape1[j] > 1) ? sIn1 : 0;
25 m_DimData[j].m_StrideOut = sOut;
References BroadcastLoop::GetNumDimensions().
◆ BroadcastLoop() [2/2]
Definition at line 33 of file Broadcast.cpp.
34 : m_DimData(outShape.GetNumDimensions())
39 unsigned int sOut = 1;
41 for (
unsigned int j = numDims - 1, k = 0; k < numDims ; k++, j--)
43 m_DimData[j].m_DimSize = outShape[j];
44 m_DimData[j].m_Stride1 = (inShape[j] > 1) ? sIn : 0;
45 m_DimData[j].m_StrideOut = sOut;
References BroadcastLoop::GetNumDimensions().
◆ GetNumDimensions()
unsigned int GetNumDimensions |
( |
| ) |
|
|
inline |
◆ Unroll() [1/2]
void Unroll |
( |
Func |
operationFunc, |
|
|
unsigned int |
dimension, |
|
|
DecoderOp & |
inData, |
|
|
EncoderOp & |
outData |
|
) |
| |
|
inline |
Definition at line 62 of file Broadcast.hpp.
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;
References BroadcastLoop::GetNumDimensions(), and BroadcastLoop::Unroll().
◆ Unroll() [2/2]
void Unroll |
( |
Func |
operationFunc, |
|
|
unsigned int |
dimension, |
|
|
DecoderOp & |
inData0, |
|
|
DecoderOp & |
inData1, |
|
|
EncoderOp & |
outData |
|
) |
| |
|
inline |
Definition at line 26 of file Broadcast.hpp.
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;
References BroadcastLoop::GetNumDimensions().
Referenced by ElementwiseBinaryFunction< Functor >::ElementwiseBinaryFunction(), ElementwiseUnaryFunction< Functor >::ElementwiseUnaryFunction(), LogicalBinaryFunction< Functor >::LogicalBinaryFunction(), LogicalUnaryFunction< Functor >::LogicalUnaryFunction(), armnn::PreluImpl(), and BroadcastLoop::Unroll().
The documentation for this struct was generated from the following files: