use guard_or_false in checkInBoundsForStorage (#155874)

this was added in https://github.com/pytorch/pytorch/pull/147354, the comment already justify guard_or_false
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155874
Approved by: https://github.com/bobrenjc93
This commit is contained in:
Laith Sakka
2025-06-12 17:47:17 -07:00
committed by PyTorch MergeBot
parent d79651571f
commit 7070ab3180

View File

@ -101,7 +101,7 @@ inline void checkInBoundsForStorage(
// It's ok to always evaluate to False for this early return for SymInts because
// (1) maybe_convert_symint below only installs guard for int64_t case
// (2) we check for this condition in the TORCH_MAYBE_SYM_CHECK below
if (TORCH_GUARD_SIZE_OBLIVIOUS(sym_eq(storage_size_bytes, 0))) {
if (TORCH_GUARD_OR_FALSE(sym_eq(storage_size_bytes, 0))) {
// NB: (a tensor with arbitrary 0 dims)'s storage can have any numel.
return;
}