Doc format fixes.

PiperOrigin-RevId: 340494524
Change-Id: I7662470f5d63b860896b2845cd48a4abc00d5348
This commit is contained in:
Mark Daoust 2020-11-03 11:59:49 -08:00 committed by TensorFlower Gardener
parent d7a91161c0
commit 3113c71abd
2 changed files with 40 additions and 36 deletions

View File

@ -160,12 +160,14 @@ class DeviceSpecV2(object):
def parse_from_string(self, spec): def parse_from_string(self, spec):
"""Parse a `DeviceSpec` name into its components. """Parse a `DeviceSpec` name into its components.
2.x behavior change: **2.x behavior change**:
In TensorFlow 1.x, this function mutates its own state and returns itself. In TensorFlow 1.x, this function mutates its own state and returns itself.
In 2.x, DeviceSpecs are immutable, and this function will return a In 2.x, DeviceSpecs are immutable, and this function will return a
DeviceSpec which contains the spec. DeviceSpec which contains the spec.
Recommended: * Recommended:
``` ```
# my_spec and my_updated_spec are unrelated. # my_spec and my_updated_spec are unrelated.
my_spec = tf.DeviceSpec.from_string("/CPU:0") my_spec = tf.DeviceSpec.from_string("/CPU:0")
@ -174,7 +176,8 @@ class DeviceSpecV2(object):
... ...
``` ```
Will work in 1.x and 2.x (though deprecated in 2.x): * Will work in 1.x and 2.x (though deprecated in 2.x):
``` ```
my_spec = tf.DeviceSpec.from_string("/CPU:0") my_spec = tf.DeviceSpec.from_string("/CPU:0")
my_updated_spec = my_spec.parse_from_string("/GPU:0") my_updated_spec = my_spec.parse_from_string("/GPU:0")
@ -182,7 +185,8 @@ class DeviceSpecV2(object):
... ...
``` ```
Will NOT work in 2.x: * Will NOT work in 2.x:
``` ```
my_spec = tf.DeviceSpec.from_string("/CPU:0") my_spec = tf.DeviceSpec.from_string("/CPU:0")
my_spec.parse_from_string("/GPU:0") # <== Will not update my_spec my_spec.parse_from_string("/GPU:0") # <== Will not update my_spec

View File

@ -4003,7 +4003,7 @@ def batch_to_space_v2(input, block_shape, crops, name=None): # pylint: disable=
Examples: Examples:
(1) For the following input of shape `[4, 1, 1, 1]`, 1. For the following input of shape `[4, 1, 1, 1]`,
`block_shape = [2, 2]`, and `crops = [[0, 0], [0, 0]]`: `block_shape = [2, 2]`, and `crops = [[0, 0], [0, 0]]`:
```python ```python
@ -4020,7 +4020,7 @@ def batch_to_space_v2(input, block_shape, crops, name=None): # pylint: disable=
[[3], [4]]]] [[3], [4]]]]
``` ```
(2) For the following input of shape `[4, 1, 1, 3]`, 2. For the following input of shape `[4, 1, 1, 3]`,
`block_shape = [2, 2]`, and `crops = [[0, 0], [0, 0]]`: `block_shape = [2, 2]`, and `crops = [[0, 0], [0, 0]]`:
```python ```python
@ -4037,7 +4037,7 @@ def batch_to_space_v2(input, block_shape, crops, name=None): # pylint: disable=
[[7, 8, 9], [10, 11, 12]]]] [[7, 8, 9], [10, 11, 12]]]]
``` ```
(3) For the following 3. For the following
input of shape `[4, 2, 2, 1]`, input of shape `[4, 2, 2, 1]`,
`block_shape = [2, 2]`, and `crops = [[0, 0], [0, 0]]`: `block_shape = [2, 2]`, and `crops = [[0, 0], [0, 0]]`:
@ -4057,7 +4057,7 @@ def batch_to_space_v2(input, block_shape, crops, name=None): # pylint: disable=
[[13], [14], [15], [16]]] [[13], [14], [15], [16]]]
``` ```
(4) For the following input of shape 4. For the following input of shape
`[8, 1, 3, 1]`, `[8, 1, 3, 1]`,
`block_shape = [2, 2]`, and `crops = [[0, 0], [2, 0]]`: `block_shape = [2, 2]`, and `crops = [[0, 0], [2, 0]]`: