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

Method run

src/core/CL/kernels/CLComparisonKernel.cpp:190–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190void CLComparisonKernel::run(const Window &window, cl::CommandQueue &queue)
191{
192 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
193 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICLKernel::window(), window);
194
195 const TensorShape &in_shape1 = _input1->info()->tensor_shape();
196 const TensorShape &in_shape2 = _input2->info()->tensor_shape();
197 const TensorShape &out_shape = _output->info()->tensor_shape();
198
199 bool can_collapse = true;
200 const bool is_vector = in_shape1.num_dimensions() == 1 || in_shape2.num_dimensions() == 1;
201 if (std::min(in_shape1.total_size(), in_shape2.total_size()) > 1 && !is_vector)
202 {
203 can_collapse = (std::min(in_shape1.num_dimensions(), in_shape2.num_dimensions()) > Window::DimZ);
204 for (size_t d = Window::DimZ; can_collapse && (d < out_shape.num_dimensions()); d++)
205 {
206 can_collapse = (in_shape1[d] == in_shape2[d]);
207 }
208 }
209
210 bool has_collapsed = false;
211 Window collapsed =
212 can_collapse ? window.collapse_if_possible(ICLKernel::window(), Window::DimZ, &has_collapsed) : window;
213
214 const TensorShape &in_shape1_collapsed = has_collapsed ? in_shape1.collapsed_from(Window::DimZ) : in_shape1;
215 const TensorShape &in_shape2_collapsed = has_collapsed ? in_shape2.collapsed_from(Window::DimZ) : in_shape2;
216
217 Window slice = collapsed.first_slice_window_3D();
218 Window slice_input1 = slice.broadcast_if_dimension_le_one(in_shape1_collapsed);
219 Window slice_input2 = slice.broadcast_if_dimension_le_one(in_shape2_collapsed);
220
221 do
222 {
223 unsigned int idx = 0;
224
225 add_3D_tensor_argument(idx, _input1, slice_input1);
226 add_3D_tensor_argument(idx, _input2, slice_input2);
227 add_3D_tensor_argument(idx, _output, slice);
228
229 enqueue(queue, *this, slice, lws_hint());
230
231 ARM_COMPUTE_UNUSED(collapsed.slide_window_slice_3D(slice_input1));
232 ARM_COMPUTE_UNUSED(collapsed.slide_window_slice_3D(slice_input2));
233 } while (collapsed.slide_window_slice_3D(slice));
234}
235
236} // namespace arm_compute

Callers

nothing calls this directly

Calls 8

collapse_if_possibleMethod · 0.80
collapsed_fromMethod · 0.80
first_slice_window_3DMethod · 0.80
slide_window_slice_3DMethod · 0.80
infoMethod · 0.45
num_dimensionsMethod · 0.45
total_sizeMethod · 0.45

Tested by

no test coverage detected