reduce Class — pytorch Architecture
Architecture documentation for the reduce class in ReduceUtils.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/cpu/ReduceUtils.h lines 43–59
template <typename scalar_t, ReductionType reduce>
inline vec_scalar_t<scalar_t> init_value() {
using acc_t = vec_scalar_t<scalar_t>;
acc_t val;
if (reduce == ReductionType::SUM ||
reduce == ReductionType::MEAN) {
val = static_cast<acc_t>(0);
} else if (reduce == ReductionType::PROD) {
val = static_cast<acc_t>(1);
} else if (reduce == ReductionType::MAX) {
val = -std::numeric_limits<acc_t>::infinity();
} else {
TORCH_INTERNAL_ASSERT(reduce == ReductionType::MIN);
val = std::numeric_limits<acc_t>::infinity();
}
return val;
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free