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;
67 unsigned int outputChannels = 0;
68 unsigned int outputHeight = 0;
69 unsigned int outputWidth = 0;
71 auto inputData = MakeDecoder<float>(inputInfo, inputHandle->
Map());
72 auto outData = MakeEncoder<float>(outputInfo, outputHandle->
Map());
79 auto outputData = MakeEncoder<float>(temporaryInfo, outputHandle->
Map());
80 FillOutputWithPadValue(*outputData, padValue, numOutputElements);
84 FillOutputWithPadValue(*outData, padValue, numOutputElements);
90 switch(numInputDimensions) {
93 inputWidth = inputShape[0];
94 for (
unsigned int w = 0; w < inputWidth ; w++)
97 auto inputValue = input.
Get();
98 auto outputIndex = w + std::get<0>(padList[0]);
100 output.
Set(inputValue);
105 inputHeight = inputShape[0];
106 inputWidth = inputShape[1];
107 outputWidth = outputShape[1];
109 for (
unsigned int h = 0; h < inputHeight; h++)
111 for (
unsigned int w = 0; w < inputWidth ; w++)
113 input[h * inputWidth + w];
114 auto inputValue = input.
Get();
115 auto outputIndex = (h + std::get<0>(padList[0])) * outputWidth + (w + std::get<0>(padList[1]));
117 output.
Set(inputValue);
123 inputChannels = inputShape[0];
124 inputHeight = inputShape[1];
125 inputWidth = inputShape[2];
126 outputHeight = outputShape[1];
127 outputWidth = outputShape[2];
129 for (
unsigned int c = 0; c < inputChannels; c++)
131 for (
unsigned int h = 0; h < inputHeight; h++)
133 for (
unsigned int w = 0; w < inputWidth ; w++)
135 input[c * inputHeight * inputWidth + h * inputWidth + w];
136 auto inputValue = input.
Get();
137 auto outputIndex = (c + std::get<0>(padList[0])) * outputHeight * outputWidth
138 + (h + std::get<0>(padList[1])) * outputWidth
139 + (w + std::get<0>(padList[2]));
141 output.
Set(inputValue);
148 inputBatches = inputShape[0];
149 inputChannels = inputShape[1];
150 inputHeight = inputShape[2];
151 inputWidth = inputShape[3];
152 outputChannels = outputShape[1];
153 outputHeight = outputShape[2];
154 outputWidth = outputShape[3];
156 for (
unsigned int b = 0; b < inputBatches; b++)
158 for (
unsigned int c = 0; c < inputChannels; c++)
160 for (
unsigned int h = 0; h < inputHeight; h++)
162 for (
unsigned int w = 0; w < inputWidth ; w++)
164 input[b * inputChannels * inputHeight * inputWidth
165 + c * inputHeight * inputWidth
168 auto inputValue = input.
Get();
169 auto outputIndex = (b + std::get<0>(padList[0]))
170 * outputChannels * outputHeight * outputWidth
171 + (c + std::get<0>(padList[1])) * outputHeight * outputWidth
172 + (h + std::get<0>(padList[2])) * outputWidth
173 + (w + std::get<0>(padList[3]));
175 output.
Set(inputValue);