From 5890401336c149f49892579bb1a7f4e7c6a52fea Mon Sep 17 00:00:00 2001 From: Igor Ganichev Date: Mon, 26 Mar 2018 12:47:47 -0700 Subject: [PATCH] Clarify doc strings on gradient methods PiperOrigin-RevId: 190508614 --- tensorflow/python/eager/backprop.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tensorflow/python/eager/backprop.py b/tensorflow/python/eager/backprop.py index cdcce65..a7837b8 100644 --- a/tensorflow/python/eager/backprop.py +++ b/tensorflow/python/eager/backprop.py @@ -172,7 +172,7 @@ def implicit_val_and_grad(f): The wrapped function returns the value and the gradient of f when called with the same arguments. The gradient is with respect to all TFE variables which - have `variable.watch()` called on them by f. + are either trainable or have `variable.watch()` called on them by f. This function is useful when the exact set of variables to differentiate with is not known ahead of time. @@ -249,8 +249,8 @@ def implicit_grad(f): """Returns a function which differentiates f with respect to variables. The wrapped function returns the gradient of f when called with the same - arguments. The gradient is with respect to all TFE variables which have - `variable.watch()` called on them by f. + arguments. The gradient is with respect to all TFE variables which are + either trainable or have `variable.watch()` called on them by f. This function is useful when the exact set of variables to differentiate with is not known ahead of time. @@ -653,10 +653,10 @@ class GradientTape(object): Operations are recorded if they are executed within this context manager and at least one of their inputs is being "watched". - Variables (created by `tf.contrib.eager.Variable` or @{tf.get_variable}) - are automatically watched. Tensors can be manually watched by invoking the - `watch` - method on this context manager. + Trainable variables (created by `tf.contrib.eager.Variable` or + @{tf.get_variable}, trainable=True is default in both cases) are automatically + watched. Tensors can be manually watched by invoking the `watch` method on + this context manager. For example, consider the function `y = x * x`. The gradient at `x = 3.0` can be computed as: -- 2.7.4