Unlock this feature

This feature isn’t part of your plan yet

Contact sales to get upgraded to the full DevStudio experience.

Unlock this feature

This feature isn't part of your plan yet.

Tilewise Operations

Tilewise Lamda Function

invokeTilewisefunction
File: /src/tilewise.hppLines 134–164

Automatically creates general flow to apply a lambda function tilewise to data in ddr or data in ocm

template <MultiCoreMode multicoreMode = MultiCoreMode::Single,
          Granularity granularity = Granularity::Square,
          typename AxesVal = AxisGroup<Direction::Channel, Direction::Width, Direction::Height>,
          typename InTensorShape,
          typename OutTensorShape,
          typename Func,
          typename OcmAllocatorType = MemAllocator,
          typename InT = typename InTensorShape::elemType,
          typename OutT = typename OutTensorShape::elemType,
          std::enable_if_t<compareSequences(InTensorShape::dimSequence, OutTensorShape::dimSequence) &&
            std::is_convertible<typename std::result_of_t<Func(InT&)>, OutT>::value, int> = 0>
INLINE void invokeTilewise(InTensorShape& inp,
                           OutTensorShape& out,
                           const Func func,
                           OcmAllocatorType&& ocmMemAlloc = OcmAllocatorType())
NameTypeDefaultDescription
multicoreModeMultiCoreModeMultiCoreMode::SingleMulti-core behavior (Single or All).
granularityGranularityGranularity::SquareThe granularity of the iterator.
AxesValtypenameAxisGroup<Direction::Channel, Direction::Width, Direction::Height>The axis pattern to access data with.
InTensorShapetypenameThe input tensor data type.
OutTensorShapetypenameThe output tensor data type.
FunctypenameThe type of the function to apply, must be callable on the element type of the tensor.
OcmAllocatorTypetypenameMemAllocatorType of ocm allocator.
InTtypenametypename InTensorShape::elemTypeThe element type of input tensor.
OutTtypenametypename OutTensorShape::elemTypeThe element type of output tensor.
NameTypeDescription
inpInTensorShape&The input ddr or ocm region.
outOutTensorShape&The output ddr or ocm region.
funcconst FuncThe function to apply.
ocmMemAllocOcmAllocatorType&&Ocm memory allocator.

INLINE void

Tilewise Sum

calculateTileSumfunction
File: /src/neuralNetBlocks/pool.hppLines 976–984

Calculates tile sum across each tile in the input NDArray.

template <std::int32_t numChn,
          std::int32_t reductionHeight = core_array::coreDim,
          std::int32_t reductionWidth = core_array::coreDim,
          typename T>
INLINE void calculateTileSum(container::NDArray<qVar_t<T>, numChn>& qData)
NameTypeDefaultDescription
numChnstd::int32_tNumber of elements in NDArray.
reductionHeightstd::int32_tcore_array::coreDimReduction Receptive Field in Height.
reductionWidthstd::int32_tcore_array::coreDimReduction Receptive Field in Width.
TtypenameThe type of the data.
NameTypeDescription
qDatacontainer::NDArray<qVar_t<T>, numChn>&The input NDArray.

INLINE void

Tilewise Max

calculateTileMaximumfunction
File: /src/neuralNetBlocks/pool.hppLines 1012–1051

Calculates the tile max for each qVar_t in the input array.

After the function, each element holds the max of all of the elements in that tile. This is done by first computing the max of each row with west <-> east neighbor movement and then computing the max column-wise using north <-> south neighbor movement.

The parameters "reductionHeight" and "reductionWidth" specify a rectangular area in which computations are performed, avoiding unnecessary data movements by only computing values within the specified area. By utilizing these parameters, performance improvements can be observed when the data does not utilize the full tile.

template <std::int32_t numChn,
          std::int32_t reductionHeight = core_array::coreDim,
          std::int32_t reductionWidth = core_array::coreDim,
          typename T>
INLINE void calculateTileMaximum(container::NDArray<qVar_t<T>, numChn>& qData)
NameTypeDefaultDescription
numChnstd::int32_tThe number of tiles to operate over
reductionHeightstd::int32_tcore_array::coreDimReduction Receptive Field in Height
reductionWidthstd::int32_tcore_array::coreDimReduction Receptive Field in Width / // clang-format on
TtypenameThe type of the data in the qVar_t's
NameTypeDescription
qDatacontainer::NDArray<qVar_t<T>, numChn>&The input ND array

INLINE void

Tilewise Average

calculateTileAveragefunction
File: /src/neuralNetBlocks/pool.hppLines 1181–1189

Calculates the tile average for each qVar_t in the input array. After the function, each element holds the average of all of the elements in that tile.

template <std::int32_t reductionHeight = core_array::coreDim,
          std::int32_t reductionWidth = core_array::coreDim,
          std::size_t numTiles,
          typename T>
void calculateTileAverage(container::NDArray<qVar_t<T>, numTiles>& qData)
NameTypeDefaultDescription
reductionHeightstd::int32_tcore_array::coreDimReduction receptive field in height.
reductionWidthstd::int32_tcore_array::coreDimReduction receptive field in width.
numTilesstd::size_tThe number of tiles to process.
TtypenameThe input type.
NameTypeDescription
qDatacontainer::NDArray<qVar_t<T>, numTiles>&The input NDArray.

void

Sign in to your account

Don't have an account? 
By signing in, you are agreeing to our Terms of Use and Privacy Policy.
Quadric // One architecture. Every algorithm.

Develop.

Simulate.

Profile.

Collaborate.