value Class — pytorch Architecture
Architecture documentation for the value class in vec_test_all_types.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/test/vec_test_all_types.h lines 486–503
template <typename T>
std::enable_if_t < !is_complex<T>::value, void> filter_add_overflow(T& a, T& b) {
if constexpr (std::is_integral_v<T> == false) return;
T max = std::numeric_limits<T>::max();
T min = std::numeric_limits<T>::min();
// min <= (a +b) <= max;
// min - b <= a <= max - b
if (b < 0) {
if (a < min - b) {
a = min - b;
}
}
else {
if (a > max - b) {
a = max - b;
}
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free