@@ -1453,10 +1453,16 @@ def set_subtensor(x, y, inplace=False, tolerate_inplace_aliasing=False):
1453
1453
1454
1454
Examples
1455
1455
--------
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.
1460
1466
1461
1467
"""
1462
1468
return inc_subtensor (
@@ -1504,17 +1510,21 @@ def inc_subtensor(
1504
1510
--------
1505
1511
To replicate the expression ``r[10:] += 5``:
1506
1512
1507
- ..code-block:: python
1513
+ .. code-block:: python
1514
+
1515
+ from pytensor.tensor import ivector, inc_subtensor
1508
1516
1509
- r = ivector()
1517
+ r = ivector("r" )
1510
1518
new_r = inc_subtensor(r[10:], 5)
1511
1519
1512
1520
To replicate the expression ``r[[0, 1, 0]] += 5``:
1513
1521
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)
1515
1526
1516
- r = ivector()
1517
- new_r = inc_subtensor(r[10:], 5, ignore_duplicates=True)
1527
+ Consider using :meth:`pytensor.tensor.variable.TensorVariable.inc` instead.
1518
1528
1519
1529
"""
1520
1530
# First of all, y cannot have a higher dimension than x,
0 commit comments