@@ -43,7 +43,7 @@ tf.print(x) # Error -- x may be None here
43
43
```
44
44
45
45
For this reason, AutoGraph forbids variables to be defined in only one branch
46
- of a TensorFlow conditional, if the variable is used afterwards :
46
+ of a TensorFlow conditional, if the variable is used afterward :
47
47
48
48
```
49
49
del x
@@ -172,7 +172,7 @@ The examples below use a `while` loop, but the same notions extend to all
172
172
control flow such as ` if ` and ` for ` statements.
173
173
174
174
In the example below, ` x ` needs to become a loop variable of the
175
- corresponding ` tf.while_loop':
175
+ corresponding ' tf.while_loop':
176
176
177
177
```
178
178
while x > 0:
@@ -343,7 +343,7 @@ recognizes.
343
343
344
344
AutoGraph assumes that variables that local functions close over may be used
345
345
anywhere in the parent function, because in general it is possible to hide a
346
- function call in almost any Python statement) . For this reason, these variables
346
+ function call in almost any Python statement. For this reason, these variables
347
347
are accounted within TensorFlow loops.
348
348
349
349
For example, the following code correctly captures ` a ` in the TensorFlow loop
@@ -358,7 +358,7 @@ for i in tf.range(3):
358
358
f() # Prints 2
359
359
```
360
360
361
- An consequence is that these variables must be defined before the loop (see
361
+ A consequence is that these variables must be defined before the loop (see
362
362
Undefined and None values above). So the following code will raise an error,
363
363
even if the variable is never used after the loop:
364
364
@@ -462,7 +462,7 @@ for i in tf.range(10):
462
462
463
463
#### Python collections of fixed structure are allowed TensorFlow control flow
464
464
465
- An exception from the previous rule is made by Python collections that are
465
+ An exception to the previous rule is made by Python collections that are
466
466
static, that is, they don't grow in size for the duration of the computation.
467
467
468
468
Caution: Use functional programming style when manipulating static collections.
@@ -503,7 +503,7 @@ for i in tf.range(10):
503
503
d[key] += i # Problem -- accessing `dict` using non-constant key
504
504
```
505
505
506
- The code above will raises an "illegal capture" error. To remedy it, write it
506
+ The code above will raise an "illegal capture" error. To remedy it, write it
507
507
in functional programming style:
508
508
509
509
```
@@ -530,7 +530,7 @@ rank is dynamic.
530
530
531
531
TensorFlow has optional static types and shapes: the shape of tensors may be
532
532
static (e.g. ` my_tensor.shape=(3, 3) ` denotes a three by three matrix) or
533
- dynamic (e.g. ` my_tensor.shape=(None, 3) ` denotes a matrix with a dynamic
533
+ dynamic (e.g. ` my_tensor.shape=(None, 3) ` ) denotes a matrix with a dynamic
534
534
number of rows and three columns. When the shapes are dynamic, you can still
535
535
query it at runtime by using the ` tf.shape() ` function.
536
536
0 commit comments