File tree Expand file tree Collapse file tree 1 file changed +23
-10
lines changed Expand file tree Collapse file tree 1 file changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -2268,36 +2268,49 @@ def add(x, y):
22682268 raise NotImplementedError ()
22692269
22702270
2271- def sub (x , y ):
2271+ def subtract (
2272+ x : SparseVariable | TensorVariable , y : SparseVariable | TensorVariable
2273+ ) -> SparseVariable :
22722274 """
22732275 Subtract two matrices, at least one of which is sparse.
22742276
2275- This method will provide the right op according
2276- to the inputs.
2277+ This method will provide the right op according to the inputs.
22772278
22782279 Parameters
22792280 ----------
2280- x
2281+ x: SparseVariable or TensorVariable
22812282 A matrix variable.
2282- y
2283+ y: SparseVariable or TensorVariable
22832284 A matrix variable.
22842285
22852286 Returns
22862287 -------
2287- A sparse matrix
2288- `x` - `y`
2288+ result: SparseVariable
2289+ Result of `x - y`, as a sparse matrix.
22892290
22902291 Notes
22912292 -----
22922293 At least one of `x` and `y` must be a sparse matrix.
22932294
2294- The grad will be structured only when one of the variable will be a dense
2295- matrix.
2296-
2295+ The grad will be structured only when one of the variable will be a dense matrix.
22972296 """
22982297 return x + (- y )
22992298
23002299
2300+ def sub (x , y ):
2301+ warn (
2302+ "pytensor.tensor.sparse.sub is deprecated and will be removed in a future version. Use "
2303+ "pytensor.tensor.sparse.subtract instead." ,
2304+ category = DeprecationWarning ,
2305+ stacklevel = 2 ,
2306+ )
2307+
2308+ return subtract (x , y )
2309+
2310+
2311+ sub .__doc__ = subtract .__doc__
2312+
2313+
23012314class MulSS (Op ):
23022315 # mul(sparse, sparse)
23032316 # See the doc of mul() for more detail
You can’t perform that action at this time.
0 commit comments