is_floating_point_v Class — pytorch Architecture
Architecture documentation for the is_floating_point_v class in TransformationHelper.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/core/TransformationHelper.h lines 58–72
template <typename T, typename V>
C10_HOST_DEVICE inline std::enable_if_t<!std::is_floating_point_v<T>, T>uniform_int(V val) {
if constexpr (std::is_same_v<T, bool>) {
return static_cast<bool>(val & 1);
} else if constexpr (std::is_same_v<T, int64_t>) {
return static_cast<T>(val % (static_cast<uint64_t>(std::numeric_limits<T>::max()) + 1));
} else if constexpr (std::is_same_v<T, at::Half> || std::is_same_v<T, at::BFloat16>) {
return static_cast<T>(val % static_cast<uint64_t>((1ULL << std::numeric_limits<T>::digits) + 1));
} else if constexpr (std::is_integral_v<T>) {
return static_cast<T>(val % (static_cast<uint64_t>(std::numeric_limits<T>::max()) + 1));
} else {
assert(false);
return 0;
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free