20 unsigned int paddingTop,
21 unsigned int paddingLeft,
22 unsigned int paddingFront,
26 unsigned int xDilation,
27 unsigned int yDilation,
28 unsigned int zDilation)
30 if (biasEnabled && !pBiasDecoder)
37 const unsigned int heightIndex = dataLayoutIndexed.
GetHeightIndex();
38 const unsigned int widthIndex = dataLayoutIndexed.
GetWidthIndex();
39 const unsigned int depthIndex = dataLayoutIndexed.
GetDepthIndex();
41 const unsigned int inChannels = rInputShape[channelsIndex];
42 const unsigned int outChannels = rOutputShape[channelsIndex];
44 const unsigned int batchSize = rOutputShape[0];
45 const unsigned int outputHeight = rOutputShape[heightIndex];
46 const unsigned int outputWidth = rOutputShape[widthIndex];
47 const unsigned int outputDepth = rOutputShape[depthIndex];
48 const unsigned int inputHeight = rInputShape[heightIndex];
49 const unsigned int inputWidth = rInputShape[widthIndex];
50 const unsigned int inputDepth = rInputShape[depthIndex];
53 const unsigned int filterDepth = rFilterShape[0];
54 const unsigned int filterHeight = rFilterShape[1];
55 const unsigned int filterWidth = rFilterShape[2];
57 const std::vector<float> inputVec = rInputDecoder.
DecodeTensor(rInputShape);
58 const std::vector<float> filterVec = rFilterDecoder.
DecodeTensor(rFilterShape);
61 const std::vector<float> biasVec = biasEnabled ? pBiasDecoder->
DecodeTensor(biasShape) : std::vector<float>();
63 for (
unsigned int batchIdx = 0; batchIdx < batchSize; batchIdx++)
65 for (
unsigned int zOutput = 0; zOutput < outputDepth; zOutput++)
67 for (
unsigned int xOutput = 0; xOutput < outputWidth; xOutput++)
69 for (
unsigned int yOutput = 0; yOutput < outputHeight; yOutput++)
71 for (
unsigned int cOutput = 0; cOutput < outChannels; cOutput++)
77 for (
unsigned int zFilter = 0; zFilter < filterDepth; zFilter++)
79 for (
unsigned int yFilter = 0; yFilter < filterHeight; yFilter++)
81 for (
unsigned int xFilter = 0; xFilter < filterWidth; xFilter++)
83 for (
unsigned int cInput = 0; cInput < inChannels; cInput++)
86 unsigned int filterIndex = 0;
91 filterIndex = zFilter * filterHeight * filterWidth * inChannels * outChannels +
92 yFilter * filterWidth * inChannels * outChannels +
93 xFilter * inChannels * outChannels +
94 cInput * outChannels +
97 unsigned int yInput = yOutput * yStride + yFilter * yDilation;
98 unsigned int xInput = xOutput * xStride + xFilter * xDilation;
99 unsigned int zInput = zOutput * zStride + zFilter * zDilation;
104 if (yInput < paddingTop || yInput >= inputHeight + paddingTop ||
105 xInput < paddingLeft || xInput >= inputWidth + paddingLeft ||
106 zInput < paddingFront || zInput >= inputDepth + paddingFront)
112 unsigned int inputIndex = 0;
119 batchIdx * inputDepth * inputHeight * inputWidth * inChannels +
120 (zInput-paddingFront) * inputHeight * inputWidth * inChannels +
121 (yInput-paddingTop) * inputWidth * inChannels +
122 (xInput-paddingLeft) * inChannels +
129 batchIdx * inputDepth * inputHeight * inputWidth * inChannels +
130 inputDepth * inputHeight * inputWidth * cInput +
131 (zInput-paddingFront) * inputHeight * inputWidth +
132 (yInput-paddingTop) * inputWidth +
136 inputValue = inputVec[inputIndex];
139 sum += filterVec[filterIndex] * inputValue;
147 sum += biasVec[cOutput];
153 outIdx = batchIdx * outputDepth * outputHeight * outputWidth * outChannels +
154 zOutput * outputHeight * outputWidth * outChannels +
155 yOutput * outputWidth * outChannels +
156 xOutput * outChannels +
162 outIdx = batchIdx * outputDepth * outputHeight * outputWidth * outChannels +
163 cOutput * outputDepth * outputHeight * outputWidth +
164 zOutput * outputHeight * outputWidth +
165 yOutput * outputWidth +
169 rOutputEncoder[outIdx];
170 rOutputEncoder.
Set(sum);