Fix typos in tf.GradientTape documentation.
authorTom Hennigan <tomhennigan@google.com>
Mon, 30 Apr 2018 19:47:35 +0000 (12:47 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Mon, 30 Apr 2018 19:50:16 +0000 (12:50 -0700)
PiperOrigin-RevId: 194829506

tensorflow/python/eager/backprop.py

index 07aec59..d04b004 100644 (file)
@@ -681,8 +681,8 @@ class GradientTape(object):
     with tfe.GradientTape() as gg:
       gg.watch(x)
       y = x * x
-    dy_dx = gg.gradient(y, [x])[0]     # Will compute to 6.0
-  d2y_dx2 = g.gradient(dy_dx, [x])[0]  # Will compute to 2.0
+    dy_dx = gg.gradient(y, x)     # Will compute to 6.0
+  d2y_dx2 = g.gradient(dy_dx, x)  # Will compute to 2.0
   ```
 
   By default, the resources held by a GradientTape are released as soon as
@@ -697,8 +697,8 @@ class GradientTape(object):
     g.watch(x)
     y = x * x
     z = y * y
-  dy_dx = g.gradient(z, [x])[0]  # 6.0
-  dz_dx = g.gradient(y, [x])[0]  # 108.0 (4*x^3 at x = 3)
+  dz_dx = g.gradient(z, x)  # 108.0 (4*x^3 at x = 3)
+  dy_dx = g.gradient(y, x)  # 6.0
   del g  # Drop the reference to the tape
   """