Open
Description
Description
I think during the merging of SparseVariable and TensorVariables Type classes still in Aesara aesara-devs/aesara#766, there was a mistake where the Structured methods were not borrowed, instead we always convert to dense with a warning
import numpy as np
import pytensor.tensor as pt
import pytensor.sparse as ps
X_sp = ps.csc_from_dense(pt.arange(5))
X_sp.sin() # Method sin is not implemented for sparse variables. The variable will be converted to dense.
Either way, we have a sparse Sin implemented, so we should use them:
out = ps.sin(X_sp)
out.eval() # <1x5 sparse matrix of type '<class 'numpy.float64'>'
pytensor/pytensor/sparse/basic.py
Lines 3028 to 3051 in 0b632bd