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

Method run_op

src/core/NEON/kernels/NEStridedSliceKernel.cpp:152–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152void NEStridedSliceKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info)
153{
154 ARM_COMPUTE_UNUSED(info);
155 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
156 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window);
157
158 const ITensor *input = tensors.get_const_tensor(TensorType::ACL_SRC_0);
159 const ITensor *output = tensors.get_tensor(TensorType::ACL_DST);
160
161 size_t width_size = input->info()->element_size();
162
163 const bool is_shrink_x = arm_compute::helpers::bit_ops::is_bit_set(_shrink_mask, 0);
164 const bool is_shrink_y = arm_compute::helpers::bit_ops::is_bit_set(_shrink_mask, 1);
165 const bool is_shrink_z = arm_compute::helpers::bit_ops::is_bit_set(_shrink_mask, 2);
166 const bool is_shrink_w = arm_compute::helpers::bit_ops::is_bit_set(_shrink_mask, 3);
167
168 unsigned int index = 0;
169 const int idx_x = is_shrink_x ? 0 : index++;
170 const int idx_y = is_shrink_y ? 0 : index++;
171 const int idx_z = is_shrink_z ? 0 : index++;
172 const int idx_w = is_shrink_w ? 0 : index;
173
174 BiStrides shrinked_strides;
175 shrinked_strides.set(0, is_shrink_x ? 0 : _final_strides[0]);
176 shrinked_strides.set(1, is_shrink_y ? 0 : _final_strides[1]);
177 shrinked_strides.set(2, is_shrink_z ? 0 : _final_strides[2]);
178 shrinked_strides.set(3, is_shrink_w ? 0 : _final_strides[3]);
179
180 Window win = window;
181
182 size_t length_x = win.shape()[0];
183
184 if (_final_strides[0] == 1 && !is_shrink_x)
185 {
186 win.set(Window::DimX, Window::Dimension(0, 1, 1));
187 width_size = width_size * length_x;
188 }
189
190 Iterator output_it(output, win);
191
192 const int start_0 = _starts_abs[0];
193 const int start_1 = _starts_abs[1];
194 const int start_2 = _starts_abs[2];
195 const int start_3 = _starts_abs[3];
196
197 const int shrinked_stride_0 = shrinked_strides[0];
198 const int shrinked_stride_1 = shrinked_strides[1];
199 const int shrinked_stride_2 = shrinked_strides[2];
200 const int shrinked_stride_3 = shrinked_strides[3];
201
202 const int byte_increment_0 = static_cast<int>(input->info()->strides_in_bytes()[0]);
203 const int byte_increment_1 = static_cast<int>(input->info()->strides_in_bytes()[1]);
204 const int byte_increment_2 = static_cast<int>(input->info()->strides_in_bytes()[2]);
205 const int byte_increment_3 = static_cast<int>(input->info()->strides_in_bytes()[3]);
206
207 uint8_t *input_base = input->ptr_to_element(Coordinates(0, 0, 0, 0));
208 uint8_t *cur_ptr;
209

Callers

nothing calls this directly

Calls 11

is_bit_setFunction · 0.85
get_const_tensorMethod · 0.80
ptr_to_elementMethod · 0.80
CoordinatesClass · 0.70
DimensionClass · 0.50
get_tensorMethod · 0.45
element_sizeMethod · 0.45
infoMethod · 0.45
setMethod · 0.45
shapeMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected