|
10 | 10 |
|
11 | 11 | #include <c10/util/irange.h> |
12 | 12 | #include <executorch/kernels/portable/cpu/scalar_utils.h> |
13 | | -#include <executorch/kernels/portable/cpu/selective_build.h> |
14 | 13 | #include <executorch/kernels/portable/cpu/util/broadcast_indexes_range.h> |
15 | 14 | #include <executorch/kernels/portable/cpu/util/broadcast_util.h> |
16 | 15 | #include <executorch/kernels/portable/cpu/util/dtype_util.h> |
@@ -319,22 +318,20 @@ inline void apply_elementwise_fn( |
319 | 318 | } |
320 | 319 |
|
321 | 320 | constexpr auto compute_type = CppTypeToScalarType<CTYPE_COMPUTE>::value; |
322 | | - if constexpr (should_include_kernel_dtype(op_name, compute_type)) { |
323 | | - const bool all_inputs_compute_dtype = |
324 | | - ((inputs.first->scalar_type() == compute_type) && ...); |
325 | | - |
326 | | - constexpr ScalarType out_specialized_scalar_type = |
327 | | - specialized_output_scalar_type<CTYPE_COMPUTE>(out_dtypes); |
328 | | - if (all_inputs_compute_dtype && |
329 | | - out.scalar_type() == out_specialized_scalar_type) { |
330 | | - using CTYPE_OUT = |
331 | | - typename ScalarTypeToCppType<out_specialized_scalar_type>::type; |
332 | | - dtype_specialized_elementwise_fn_impl< |
333 | | - CTYPE_COMPUTE, |
334 | | - CTYPE_OUT, |
335 | | - support_noncontiguous_tensors>(compute_fun, ctx, out, inputs...); |
336 | | - return; |
337 | | - } |
| 321 | + const bool all_inputs_compute_dtype = |
| 322 | + ((inputs.first->scalar_type() == compute_type) && ...); |
| 323 | + |
| 324 | + constexpr ScalarType out_specialized_scalar_type = |
| 325 | + specialized_output_scalar_type<CTYPE_COMPUTE>(out_dtypes); |
| 326 | + if (all_inputs_compute_dtype && |
| 327 | + out.scalar_type() == out_specialized_scalar_type) { |
| 328 | + using CTYPE_OUT = |
| 329 | + typename ScalarTypeToCppType<out_specialized_scalar_type>::type; |
| 330 | + dtype_specialized_elementwise_fn_impl< |
| 331 | + CTYPE_COMPUTE, |
| 332 | + CTYPE_OUT, |
| 333 | + support_noncontiguous_tensors>(compute_fun, ctx, out, inputs...); |
| 334 | + return; |
338 | 335 | } |
339 | 336 |
|
340 | 337 | apply_elementwise_fn_generic_impl< |
|
0 commit comments