[PyTorch] Add isfinite to BFloat16-math.h (#135052)

Missing function from <cmath>.

Differential Revision: [D62148884](https://our.internmc.facebook.com/intern/diff/D62148884/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/135052
Approved by: https://github.com/PaliC, https://github.com/albanD
ghstack dependencies: #135031
This commit is contained in:
Scott Wolchok 2024-09-04 14:16:33 -07:00 committed by PyTorch MergeBot
parent 7fe819d917
commit a5d70cf545

View file

@ -68,6 +68,12 @@ template <
inline T expm1(T a) {
return std::expm1(float(a));
}
template <
typename T,
typename std::enable_if_t<is_reduced_floating_point_v<T>, int> = 0>
inline bool isfinite(T a) {
return std::isfinite(float(a));
}
template <
typename T,
typename std::enable_if_t<is_reduced_floating_point_v<T>, int> = 0>