reduce_all_impl Class — pytorch Architecture
Architecture documentation for the reduce_all_impl class in ReduceAllOpsKernel.cpp from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/cpu/ReduceAllOpsKernel.cpp lines 46–63
template <typename scalar_t, typename func_t>
inline void reduce_all_impl(
Tensor& output,
const Tensor& input,
const scalar_t ident_v,
func_t op) {
const int64_t input_numel = input.numel();
auto input_data = input.const_data_ptr<scalar_t>();
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 = ident;
for (const auto i : c10::irange(start, end)) {
partial_out = op(partial_out, input_data[i]);
}
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