()
| 111 | |
| 112 | |
| 113 | def test_array_function_sparse_tensordot(): |
| 114 | sparse = pytest.importorskip("sparse") |
| 115 | rng = np.random.default_rng() |
| 116 | x = rng.random((2, 3, 4)) |
| 117 | x[x < 0.9] = 0 |
| 118 | y = rng.random((4, 3, 2)) |
| 119 | y[y < 0.9] = 0 |
| 120 | |
| 121 | xx = sparse.COO(x) |
| 122 | yy = sparse.COO(y) |
| 123 | |
| 124 | assert_eq( |
| 125 | np.tensordot(x, y, axes=(2, 0)), np.tensordot(xx, yy, axes=(2, 0)).todense() |
| 126 | ) |
| 127 | |
| 128 | |
| 129 | @pytest.mark.parametrize("chunks", [(100, 100), (500, 100)]) |