47 const unsigned int inputBatchSize = inputShape[0];
48 const unsigned int inputChannels = inputShape[dataLayout.
GetChannelsIndex()];
50 const unsigned int outputHeight = outputShape[dataLayout.
GetHeightIndex()];
51 const unsigned int outputWidth = outputShape[dataLayout.
GetWidthIndex()];
52 const unsigned int outputChannels = outputShape[dataLayout.
GetChannelsIndex()];
59 "Input shape must be divisible by block size in all spatial dimensions: Block size is"
63 for (
unsigned int outChannelIndex = 0; outChannelIndex < outputChannels; outChannelIndex++)
65 unsigned int inChannelIndex = outChannelIndex % inputChannels;
67 unsigned int shiftW = (outChannelIndex / inputChannels) % blockSize;
68 unsigned int shiftH = (outChannelIndex / inputChannels) / blockSize;
70 for (
unsigned int outH = 0; outH < outputHeight; outH++)
72 for (
unsigned int outW = 0; outW < outputWidth; outW++)
74 for (
unsigned int inBatchIndex = 0; inBatchIndex < inputBatchSize; inBatchIndex++)
76 unsigned int inOffset =
GetOffset(inputShape,
78 (outH * blockSize + shiftH),
79 (outW * blockSize + shiftW),
83 unsigned int outOffset =
GetOffset(outputShape,
90 outputData += outOffset;
91 inputData += inOffset;
92 outputData.
Set(inputData.
Get());
93 inputData -= inOffset;
94 outputData -= outOffset;