use sym_or instead of any to avoid dde in calc_conv_nd_return_shape (#162084)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/162084
Approved by: https://github.com/aorenste

Co-authored-by: Aaron Orenstein <aorenste@fb.com>
This commit is contained in:
Laith Sakka
2025-09-03 15:30:39 -07:00
committed by PyTorch MergeBot
parent 8678d831c4
commit fbf3d2027d

View File

@ -2373,9 +2373,10 @@ def calc_conv_nd_return_shape(
ret_shape.append(
_formula(dims[i], padding[i], dilation[i], kernel_size[i], stride[i])
)
from torch.fx.experimental.symbolic_shapes import sym_or
torch._check(
any(x > 0 for x in ret_shape[2:]),
sym_or(*[x > 0 for x in ret_shape[2:]]),
lambda: f"Given input size per channel: {list(dims)}. "
f"Calculated output size per channel: {ret_shape[2:]}. "
f"Output size is too small",