@@ -86,9 +86,7 @@ of symbolic differentiation).
8686 ``i `` of the output list is the gradient of the first argument of
8787 `pt.grad ` with respect to the ``i ``-th element of the list given as second argument.
8888 The first argument of `pt.grad ` has to be a scalar (a tensor
89- of size 1). For more information on the semantics of the arguments of
90- `pt.grad ` and details about the implementation, see
91- :ref: `this<libdoc_gradient> ` section of the library.
89+ of size 1).
9290
9391 Additional information on the inner workings of differentiation may also be
9492 found in the more advanced tutorial :ref: `Extending PyTensor<extending> `.
@@ -204,7 +202,21 @@ you need to do something similar to this:
204202>>> f([[1 , 1 ], [1 , 1 ]], [[2 , 2 ], [2 , 2 ]], [0 ,1 ])
205203array([ 2., 2.])
206204
207- :ref: `List <R_op_list >` of Op that implement Rop.
205+ By default, the R-operator is implemented as a double application of the L_operator
206+ (see `reference <https://j-towns.github.io/2017/06/12/A-new-trick.html >`_).
207+ In most cases this should be as performant as a specialized implementation of the R-operator.
208+ However, PyTensor may sometimes fail to prune dead branches or fuse common expressions within composite operators,
209+ such as Scan and OpFromGraph, that would be more easily avoidable in a direct implentation of the R-operator.
210+
211+ When this is a concern, it is possible to force `Rop ` to use the specialized `Op.R_op ` methods by passing
212+ `use_op_rop_implementation=True `. Note that this will fail if the graph contains `Op`s that don't implement this method.
213+
214+
215+ >>> JV = pytensor.gradient.Rop(y, W, V, use_op_rop_implementation = True )
216+ >>> f = pytensor.function([W, V, x], JV )
217+ >>> f([[1 , 1 ], [1 , 1 ]], [[2 , 2 ], [2 , 2 ]], [0 ,1 ])
218+ array([ 2., 2.])
219+
208220
209221L-operator
210222----------
@@ -234,7 +246,6 @@ array([[ 0., 0.],
234246 as the input parameter, while the result of the R-operator has a shape similar
235247 to that of the output.
236248
237- :ref: `List of op with r op support <R_op_list >`.
238249
239250Hessian times a Vector
240251======================
0 commit comments