SIGN IN SIGN UP

fix: correct torch.linalg.solve_triangular availability check in WMSELoss (#2045)

WMSELoss and Whitening2d gated construction on _SOLVE_TRIANGULAR_AVAILABLE,
which was set by `import torch.linalg.solve_triangular`. That statement
imports a function as a module, so it always raises ImportError, even on
PyTorch >=1.11 where torch.linalg.solve_triangular exists. The flag was
therefore always False and both classes raised RuntimeError on construction
on every supported torch version.

The test module used the same broken import to skip itself, so the failure
was never exercised in CI.

Detect the function with hasattr instead, in the module and the test. The
WMSE tests now run and pass.
L
Lőrincz-Molnár Szabolcs-Botond committed
e8d317fc5a87f4387a85a35e689869039ec249ee
Parent: 8e995ec
Committed by GitHub <noreply@github.com> on 8/21/2026, 8:49:33 PM