@@ -824,36 +824,46 @@ def compress(self, a, axis=None):
824824 """Return selected slices only."""
825825 return pt .extra_ops .compress (self , a , axis = axis )
826826
827- def set (self , idx , y , ** kwargs ):
828- """Return a copy of self with the indexed values set to y.
827+ def set (self , y , ** kwargs ):
828+ """Return a copy of the variable indexed by self with the indexed values set to y.
829829
830- Equivalent to set_subtensor(self[idx], y). See docstrings for kwargs.
830+ Equivalent to set_subtensor(self, y). See docstrings for kwargs.
831+
832+ Raises
833+ ------
834+ TypeError:
835+ If self is not the result of a subtensor operation
831836
832837 Examples
833838 --------
834839 >>> import pytensor.tensor as pt
835840 >>>
836841 >>> x = pt.ones((3,))
837- >>> out = x.set(1, 2)
842+ >>> out = x[1] .set(2)
838843 >>> out.eval() # array([1., 2., 1.])
839844 """
840- return pt .subtensor .set_subtensor (self [idx ], y , ** kwargs )
845+ return pt .subtensor .set_subtensor (self , y , ** kwargs )
846+
847+ def inc (self , y , ** kwargs ):
848+ """Return a copy of the variable indexed by self with the indexed values incremented by y.
841849
842- def inc (self , idx , y , ** kwargs ):
843- """Return a copy of self with the indexed values incremented by y.
850+ Equivalent to inc_subtensor(self, y). See docstrings for kwargs.
844851
845- Equivalent to inc_subtensor(self[idx], y). See docstrings for kwargs.
852+ Raises
853+ ------
854+ TypeError:
855+ If self is not the result of a subtensor operation
846856
847857 Examples
848858 --------
849859
850860 >>> import pytensor.tensor as pt
851861 >>>
852862 >>> x = pt.ones((3,))
853- >>> out = x.inc(1, 2)
863+ >>> out = x[1] .inc(2)
854864 >>> out.eval() # array([1., 3., 1.])
855865 """
856- return pt .inc_subtensor (self [ idx ] , y , ** kwargs )
866+ return pt .inc_subtensor (self , y , ** kwargs )
857867
858868
859869class TensorVariable (
0 commit comments