MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / update_padding_if_needed

Method update_padding_if_needed

src/core/AccessWindowTranspose.cpp:201–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201bool AccessWindowTranspose::update_padding_if_needed(const Window &window)
202{
203 // Only update the padding if the tensor allows it
204 if (_info == nullptr || !_info->is_resizable())
205 {
206 return false;
207 }
208
209 ARM_COMPUTE_ERROR_ON(window.y().step() == 0);
210 ARM_COMPUTE_ERROR_ON(window.x().step() == 0);
211
212 const int min_x = window.y().start() * _scale_x + _x;
213 const int max_x = (window.y().end() - window.y().step()) * _scale_x + _x + _width;
214 const int min_y = window.x().start() * _scale_y + _y;
215 const int max_y = (window.x().end() - window.x().step()) * _scale_y + _y + _height;
216
217 const TensorShape &shape = _info->tensor_shape();
218
219 PaddingSize padding;
220 padding.left = std::max(0, -min_x);
221 padding.right = std::max<int>(0, max_x - shape[0]);
222 padding.top = std::max(0, -min_y);
223 padding.bottom = std::max<int>(0, max_y - shape[1]);
224
225 // Update strides in tensor info
226 return _info->extend_padding(padding);
227}

Callers

nothing calls this directly

Calls 7

stepMethod · 0.80
is_resizableMethod · 0.45
yMethod · 0.45
xMethod · 0.45
startMethod · 0.45
endMethod · 0.45
extend_paddingMethod · 0.45

Tested by

no test coverage detected