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

Function execute_window

src/core/NEON/kernels/NECropKernel.cpp:122–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122inline void execute_window(const ITensor *input,
123 const ITensor *output,
124 Coordinates input_offset,
125 float extrapolation_value,
126 const std::array<uint32_t, 2> &rows_out_of_bounds,
127 const std::array<uint32_t, 2> &cols_out_of_bounds,
128 NECropKernel::InBoundsCropFunction *in_bounds_crop_function,
129 bool is_height_flipped,
130 bool has_cols_in_bounds,
131 bool has_cols_out_of_bounds_before,
132 bool has_cols_out_of_bounds_after,
133 bool input_has_single_channel,
134 bool is_width_flipped)
135{
136 // Output is always float.
137 const int window_step_x = 16 / sizeof(float);
138 auto *output_ptr = reinterpret_cast<float *>(output->buffer());
139 // Output window:
140 // --------------------------------
141 // | Out of bounds |
142 // | rows before |
143 // |------------------------------|
144 // | Out of | In | Out of |
145 // | bounds | bounds | bounds |
146 // | cols | elements | cols |
147 // | before | copied | after |
148 // | | from input | |
149 // --------------------------------
150 // | Out of bounds |
151 // | rows after |
152 // |------------------------------|
153 // Fill all output rows that have no elements that are within the input bounds with the extrapolation value.
154 // First for the rows before the in bounds rows.
155 out_of_bounds_crop_window(output, output_ptr, extrapolation_value, window_step_x, 0,
156 rows_out_of_bounds[0] * output->info()->dimension(1));
157 output_ptr += rows_out_of_bounds[0] * output->info()->dimension(1) * output->info()->dimension(0);
158 // Iterate through each row that has any elements within the input bounds.
159 for (uint32_t row = rows_out_of_bounds[0];
160 static_cast<int32_t>(row) < static_cast<int32_t>(output->info()->dimension(2) - rows_out_of_bounds[1]);
161 ++row, is_height_flipped ? --input_offset[2] : ++input_offset[2])
162 {
163 // Fill all elements in the row that are out of bounds with the extrapolation value.
164 // First for the elements before the in bounds elements.
165 if (has_cols_out_of_bounds_before)
166 {
167 out_of_bounds_crop_window(output, output_ptr, extrapolation_value, window_step_x, 0, cols_out_of_bounds[0]);
168 }
169 // Copy all elements within the input bounds from the input tensor.
170 if (has_cols_in_bounds)
171 {
172 (*in_bounds_crop_function)(input, output, output_ptr, input_offset, window_step_x, cols_out_of_bounds[0],
173 output->info()->dimension(1) - cols_out_of_bounds[1], input_has_single_channel,
174 is_width_flipped);
175 }
176 // Fill all elements after the in bounds elements with the extrapolation value.
177 if (has_cols_out_of_bounds_after)
178 {
179 out_of_bounds_crop_window(output, output_ptr, extrapolation_value, window_step_x,

Callers 1

runMethod · 0.85

Calls 4

bufferMethod · 0.45
dimensionMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected