|
1 | 1 | import numpy as np |
2 | 2 | import pytest |
| 3 | +import scipy as sp |
3 | 4 |
|
4 | 5 | import pytensor.tensor as pt |
5 | 6 | from pytensor.compile import UnusedInputError, get_mode |
|
9 | 10 | from pytensor.compile.sharedvalue import shared |
10 | 11 | from pytensor.configdefaults import config |
11 | 12 | from pytensor.graph.utils import MissingInputError |
| 13 | +from pytensor.sparse import SparseTensorType |
12 | 14 | from pytensor.tensor.math import sum as pt_sum |
13 | 15 | from pytensor.tensor.type import ( |
14 | 16 | bscalar, |
@@ -763,18 +765,15 @@ def test_shared_constructor_copies(self): |
763 | 765 | # rule #2 reading back from pytensor-managed memory |
764 | 766 | assert not np.may_share_memory(A.get_value(borrow=False), data_of(A)) |
765 | 767 |
|
| 768 | + @pytest.mark.xfail(reason="Numba does not support Sparse Ops yet") |
766 | 769 | def test_sparse_input_aliasing_affecting_inplace_operations(self): |
767 | | - sp = pytest.importorskip("scipy", minversion="0.7.0") |
768 | | - |
769 | | - from pytensor import sparse |
770 | | - |
771 | 770 | # Note: to trigger this bug with pytensor rev 4586:2bc6fc7f218b, |
772 | 771 | # you need to make in inputs mutable (so that inplace |
773 | 772 | # operations are used) and to break the elemwise composition |
774 | 773 | # with some non-elemwise op (here dot) |
775 | 774 |
|
776 | | - x = sparse.SparseTensorType("csc", dtype="float64")() |
777 | | - y = sparse.SparseTensorType("csc", dtype="float64")() |
| 775 | + x = SparseTensorType("csc", dtype="float64")() |
| 776 | + y = SparseTensorType("csc", dtype="float64")() |
778 | 777 | f = function([In(x, mutable=True), In(y, mutable=True)], (x + y) + (x + y)) |
779 | 778 | # Test 1. If the same variable is given twice |
780 | 779 |
|
|
0 commit comments