Inconsistent bilinear interpolation results when align_corners=None across CPU and GPU backends
26K reputation · 09 Aug 2022, 18:39 UTC
Goal: obtain identical interpolation outputs from torch.nn.functional.interpolate with mode='bilinear' and the default align_corners=None when running the same model on CPU and CUDA devices.
Constraint: the default value leaves the interpolation kernel unspecified, causing the CPU and CUDA backends to use different resampling schemes, which produces non‑identical results and harms reproducibility. The documentation notes that users should set align_corners to True or False for deterministic behavior, but the default remains None in all released releases, leaving an open decision about whether a future version will change the default or unify the kernels.
Will a future PyTorch release change the default align_corners value to True or False? Should users always specify align_corners to ensure device‑agnostic reproducibility? Is there a plan to make the CPU and CUDA implementations consistent when align_corners=None?