(nx)
| 76 | |
| 77 | |
| 78 | def test_convert_between_backends(nx): |
| 79 | A = np.zeros((3, 2)) |
| 80 | B = np.zeros((3, 1)) |
| 81 | |
| 82 | A2 = nx.from_numpy(A) |
| 83 | B2 = nx.from_numpy(B) |
| 84 | |
| 85 | assert isinstance(A2, nx.__type__) |
| 86 | assert isinstance(B2, nx.__type__) |
| 87 | |
| 88 | nx2 = get_backend(A2, B2) |
| 89 | |
| 90 | assert nx2.__name__ == nx.__name__ |
| 91 | |
| 92 | assert_array_almost_equal_nulp(nx.to_numpy(A2), A) |
| 93 | assert_array_almost_equal_nulp(nx.to_numpy(B2), B) |
| 94 | |
| 95 | |
| 96 | def test_empty_backend(): |
nothing calls this directly
no test coverage detected