SIGN IN SIGN UP

Fix conversion to NumPy in `TestCase` for `assertAllClose`. (#22594)

Utilities such as `assertAllClose`, `assertNotAllClose`, `assertAlmostEqual`, `assertAllEqual` convert to NumPy to use the NumPy testing utility. This was always using `backend.convert_to_numpy`. However, some unit tests use `assertAllClose` for tensors not for the current backend, for instance `tf.Tensor`s for some dataset tests.

This is causing some OpenVino tests to fail because the OpenVino `convert_to_numpy` cannot handle `tf.Tensor`s (and it shouldn't have to).

Now, we only use `backend.convert_to_numpy` for backend tensors and `Variable`s.

Also:
- fixed some tests that were incorrectly calling `backend.convert_to_numpy`.
- fixed some tests that were comparing lists/tuples of tensors directly with `assertAllClose`, which no longer works.
- fixed `ops.where` for Torch which was returning tuples of tensors instead of a single tensor.
H
hertschuh committed
9b80f8373e254fa61643356b20b7f4d9358683f3
Parent: cff7c7d
Committed by GitHub <noreply@github.com> on 3/31/2026, 8:47:49 PM