[1/N] Add strict parameter to Python zip calls (#165531)

Add `strict=True/False` to zip calls in test utils. `strict=True` is passed when possible.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/165531
Approved by: https://github.com/Skylion007
This commit is contained in:
Yuanyuan Chen
2025-10-18 05:26:29 +00:00
committed by PyTorch MergeBot
parent 0f0b4bf029
commit aaac8cb0f5
24 changed files with 111 additions and 74 deletions

View File

@ -92,7 +92,9 @@ def default_tolerances(
f"Expected a torch.Tensor or a torch.dtype, but got {type(input)} instead."
)
dtype_precisions = dtype_precisions or _DTYPE_PRECISIONS
rtols, atols = zip(*[dtype_precisions.get(dtype, (0.0, 0.0)) for dtype in dtypes])
rtols, atols = zip(
*[dtype_precisions.get(dtype, (0.0, 0.0)) for dtype in dtypes], strict=True
)
return max(rtols), max(atols)