reduce_all_impl_vec Class — pytorch Architecture
Architecture documentation for the reduce_all_impl_vec class in ReduceAllOpsKernel.cpp from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/cpu/ReduceAllOpsKernel.cpp lines 23–43
template <typename scalar_t, typename func_t, typename vec_func_t>
inline void reduce_all_impl_vec(
Tensor& output,
const Tensor& input,
const scalar_t ident_v,
func_t op,
vec_func_t vop) {
using Vec = Vectorized<opmath_type<scalar_t>>;
const int64_t input_numel = input.numel();
auto input_data = input.const_data_ptr<scalar_t>();
// NOTE: parallel_reduce not support bool type
scalar_t result = at::parallel_reduce(0, input_numel, internal::GRAIN_SIZE, ident_v,
[&](int64_t start, int64_t end, const scalar_t /*ident*/) -> scalar_t {
scalar_t partial_out = vec::reduce_all<scalar_t>(
[=](Vec x, Vec y) { return vop(x, y); },
input_data + start,
end - start);
return partial_out;
}, op);
output.fill_(result);
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free