Add admonition about as_float_unchecked() (#141742)

Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/141742
Approved by: https://github.com/bdhirsh
This commit is contained in:
Edward Z. Yang
2024-11-27 20:30:21 -05:00
committed by PyTorch MergeBot
parent d905f1350a
commit 5212ec3879

View File

@ -99,7 +99,12 @@ class C10_API SymFloat {
return ptr_;
}
// UNSAFELY coerce this SymFloat into a double. You MUST have
// established that this is a non-symbolic by some other means,
// typically by having tested is_symbolic(). You will get garbage
// from this function if is_symbolic()
double as_float_unchecked() const {
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(!is_symbolic());
return data_;
}