Initialize the kernel's input, output.
87{
88 ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input1, input2);
89 ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input1, output);
90 ARM_COMPUTE_ERROR_THROW_ON(validate_parameters(input1->info(), input2->info(),
output->info()));
91
92 _input1 = input1;
93 _input2 = input2;
95
96
97 std::string kernel_name = "binary_logical_op";
98 std::set<std::string> build_opts;
99 build_opts.emplace(("-DDATA_TYPE=" + get_cl_type_from_data_type(input1->info()->data_type())));
100
101 int op_code = 0;
102 switch (op)
103 {
105 op_code = 1;
106 break;
108 op_code = 2;
109 break;
110 default:
111 throw std::runtime_error("Operation not supported, yet");
112 }
113
114 build_opts.emplace(("-DOP_CODE=" + support::cpp11::to_string(op_code)));
115 build_opts.emplace(
116 ("-DVEC_SIZE=" + support::cpp11::to_string(num_elems_processed_per_iteration)));
117
118 _kernel =
120
121 const std::pair<TensorShape, ValidRegion> broadcast_pair =
122 ITensorInfo::broadcast_shape_and_valid_region(*input1->info(), *input2->info());
123
124 const ValidRegion &valid_region = broadcast_pair.second;
125
126 Window win = calculate_max_window(valid_region, Steps(num_elems_processed_per_iteration));
127 Window win_input1 = win.broadcast_if_dimension_le_one(*input1->info());
128 Window win_input2 = win.broadcast_if_dimension_le_one(*input2->info());
129
130 AccessWindowHorizontal input1_access(input1->info(), 0, num_elems_processed_per_iteration);
131 AccessWindowHorizontal input2_access(input2->info(), 0, num_elems_processed_per_iteration);
132 AccessWindowHorizontal output_access(
output->info(), 0, num_elems_processed_per_iteration);
133
134 update_window_and_padding(win_input1, input1_access) ||
135 update_window_and_padding(win_input2, input2_access) ||
136 update_window_and_padding(win, output_access);
137
138 output_access.set_valid_region(win, valid_region);
139
140 ICLKernel::configure_internal(win);
141}
static CLKernelLibraryEx & get()
Get the KernelLibrary singleton.
Kernel create_kernel(const std::string &kernel_name, const StringSet &build_options_set={}) const
Create a kernel from the kernel library.