25 const unsigned int numOutputElements)
27 for (
unsigned int i = 0; i < numOutputElements; ++i)
30 outputData.
Set(padValue);
58 assert(numInputDimensions == numOutputDimensions);
62 unsigned int inputBatches = 0;
63 unsigned int inputChannels = 0;
64 unsigned int inputHeight = 0;
65 unsigned int inputWidth = 0;
66 unsigned int inputDim5 = 0;
68 unsigned int outputBatches = 0;
69 unsigned int outputChannels = 0;
70 unsigned int outputHeight = 0;
71 unsigned int outputWidth = 0;
73 auto inputData = MakeDecoder<float>(inputInfo, inputHandle->
Map());
74 auto outData = MakeEncoder<float>(outputInfo, outputHandle->
Map());
82 auto outputData = MakeEncoder<float>(temporaryInfo, outputHandle->
Map());
83 FillOutputWithPadValue(*outputData, padValue, numOutputElements);
87 FillOutputWithPadValue(*outData, padValue, numOutputElements);
93 switch(numInputDimensions) {
96 inputWidth = inputShape[0];
97 for (
unsigned int w = 0; w < inputWidth ; w++)
100 auto inputValue = input.
Get();
101 auto outputIndex = w + padList[0].first;
103 output.
Set(inputValue);
108 inputHeight = inputShape[0];
109 inputWidth = inputShape[1];
110 outputWidth = outputShape[1];
112 for (
unsigned int h = 0; h < inputHeight; h++)
114 for (
unsigned int w = 0; w < inputWidth ; w++)
116 input[h * inputWidth + w];
117 auto inputValue = input.
Get();
118 auto outputIndex = (h + padList[0].first) * outputWidth + (w + padList[1].first);
120 output.
Set(inputValue);
126 inputChannels = inputShape[0];
127 inputHeight = inputShape[1];
128 inputWidth = inputShape[2];
129 outputHeight = outputShape[1];
130 outputWidth = outputShape[2];
132 for (
unsigned int c = 0; c < inputChannels; c++)
134 for (
unsigned int h = 0; h < inputHeight; h++)
136 for (
unsigned int w = 0; w < inputWidth ; w++)
138 input[c * inputHeight * inputWidth + h * inputWidth + w];
139 auto inputValue = input.
Get();
140 auto outputIndex = (c + padList[0].first) * outputHeight * outputWidth
141 + (h + padList[1].first) * outputWidth
142 + (w + padList[2].first);
144 output.
Set(inputValue);
151 inputBatches = inputShape[0];
152 inputChannels = inputShape[1];
153 inputHeight = inputShape[2];
154 inputWidth = inputShape[3];
155 outputChannels = outputShape[1];
156 outputHeight = outputShape[2];
157 outputWidth = outputShape[3];
159 for (
unsigned int b = 0; b < inputBatches; b++)
161 for (
unsigned int c = 0; c < inputChannels; c++)
163 for (
unsigned int h = 0; h < inputHeight; h++)
165 for (
unsigned int w = 0; w < inputWidth ; w++)
167 input[b * inputChannels * inputHeight * inputWidth
168 + c * inputHeight * inputWidth
171 auto inputValue = input.
Get();
172 auto outputIndex = (b + padList[0].first)
173 * outputChannels * outputHeight * outputWidth
174 + (c + padList[1].first) * outputHeight * outputWidth
175 + (h + padList[2].first) * outputWidth
176 + (w + padList[3].first);
178 output.
Set(inputValue);
186 inputBatches = inputShape[0];
187 inputChannels = inputShape[1];
188 inputHeight = inputShape[2];
189 inputWidth = inputShape[3];
190 inputDim5 = inputShape[4];
192 outputBatches = outputShape[1];
193 outputChannels = outputShape[2];
194 outputHeight = outputShape[3];
195 outputWidth = outputShape[4];
197 for (
unsigned int b = 0; b < inputBatches; ++b)
199 for (
unsigned int c = 0; c < inputChannels; ++c)
201 for (
unsigned int h = 0; h < inputHeight; ++h)
203 for (
unsigned int w = 0; w < inputWidth ; ++w)
205 for (
unsigned int d = 0; d < inputDim5 ; ++d)
207 input[b * inputChannels * inputHeight * inputWidth * inputDim5
208 + c * inputHeight * inputWidth * inputDim5
209 + h * inputWidth * inputDim5
212 auto inputValue = input.
Get();
214 auto outputIndex = (b + padList[0].first)
215 * outputBatches * outputChannels * outputHeight * outputWidth
216 + (c + padList[1].first) * outputChannels * outputHeight*outputWidth
217 + (h + padList[2].first) * outputHeight * outputWidth
218 + (w + padList[3].first) * outputWidth
219 + (d + padList[4].first);
222 output.
Set(inputValue);