@@ -1453,10 +1453,16 @@ def set_subtensor(x, y, inplace=False, tolerate_inplace_aliasing=False):
14531453
14541454 Examples
14551455 --------
1456- To replicate the numpy expression "r[10:] = 5", type
1457- >>> from pytensor.tensor import vector
1458- >>> r = vector("r")
1459- >>> new_r = set_subtensor(r[10:], 5)
1456+ To replicate the numpy expression ``r[10:] = 5``, type
1457+
1458+ .. code-block:: python
1459+
1460+ from pytensor.tensor import set_subtensor, vector
1461+
1462+ r = vector("r")
1463+ new_r = set_subtensor(r[10:], 5)
1464+
1465+ Consider using :meth:`pytensor.tensor.variable.TensorVariable.set` instead.
14601466
14611467 """
14621468 return inc_subtensor (
@@ -1504,17 +1510,21 @@ def inc_subtensor(
15041510 --------
15051511 To replicate the expression ``r[10:] += 5``:
15061512
1507- ..code-block:: python
1513+ .. code-block:: python
1514+
1515+ from pytensor.tensor import ivector, inc_subtensor
15081516
1509- r = ivector()
1517+ r = ivector("r" )
15101518 new_r = inc_subtensor(r[10:], 5)
15111519
15121520 To replicate the expression ``r[[0, 1, 0]] += 5``:
15131521
1514- ..code-block:: python
1522+ .. code-block:: python
1523+
1524+ r = ivector("r")
1525+ new_r = inc_subtensor(r[[0, 1, 0]], 5, ignore_duplicates=True)
15151526
1516- r = ivector()
1517- new_r = inc_subtensor(r[10:], 5, ignore_duplicates=True)
1527+ Consider using :meth:`pytensor.tensor.variable.TensorVariable.inc` instead.
15181528
15191529 """
15201530 # First of all, y cannot have a higher dimension than x,
0 commit comments