Update generated Python Op docs.

Change: 123168816
This commit is contained in:
A. Unique TensorFlower 2016-05-24 17:18:58 -08:00 committed by TensorFlower Gardener
parent a8bf573fb7
commit f577ada969
6 changed files with 87 additions and 23 deletions

View File

@ -1439,14 +1439,21 @@ boolean_mask(tensor, mask) ==> [[1, 2], [5, 6]]
- - -
### `tf.one_hot(indices, depth, on_value=1, off_value=0, axis=None, dtype=tf.float32, name=None)` {#one_hot}
### `tf.one_hot(indices, depth, on_value=None, off_value=None, axis=None, dtype=None, name=None)` {#one_hot}
Returns a one-hot tensor.
The locations represented by indices in `indices` take value `on_value`,
while all other locations take value `off_value`. By default, `on_value` is 1,
and `off_value` is 0. The type of the output tensor is specified by `dtype`,
which defaults to `tf.float32`.
while all other locations take value `off_value`.
`on_value` and `off_value` must have matching data types. If `dtype` is also
provided, they must be the same data type as specified by `dtype`.
If `on_value` is not provided, it will default to the value `1` with type
`dtype`
If `off_value` is not provided, it will default to the value `0` with type
`dtype`
If the input `indices` is rank `N`, the output will have rank `N+1`. The
new axis is created at dimension `axis` (default: the new axis is appended
@ -1468,6 +1475,13 @@ shape will be:
depth x batch x features if axis == 0
```
If `dtype` is not provided, it will attempt to assume the data type of
`on_value` or `off_value`, if one or both are passed in. If none of
`on_value`, `off_value`, or `dtype` are provided, `dtype` will default to the
value `tf.float32`
Note: If a non-numeric data type output is desired (tf.string, tf.bool, etc.),
both `on_value` and `off_value` _must_ be provided to `one_hot`
Examples
=========
@ -1515,6 +1529,22 @@ Then output is `[2 x 2 x 3]`:
]
```
Using default values for `on_value` and `off_value`:
```
indices = [0, 1, 2]
depth = 3
```
The output will be
```
output =
[[1., 0., 0.],
[0., 1., 0.],
[0., 0., 1.]]
```
##### Args:
@ -1535,7 +1565,8 @@ Then output is `[2 x 2 x 3]`:
##### Raises:
* <b>`TypeError`</b>: If dtype is `tf.string`
* <b>`TypeError`</b>: If dtype of either `on_value` or `off_value` don't match `dtype`
* <b>`TypeError`</b>: If dtype of `on_value` and `off_value` don't match one another

View File

@ -60,7 +60,7 @@ tf.zeros_like(tensor) ==> [[0, 0, 0], [0, 0, 0]]
* <b>`tensor`</b>: A `Tensor`.
* <b>`dtype`</b>: A type for the returned `Tensor`. Must be `float32`, `float64`,
`int8`, `int16`, `int32`, `int64`, `uint8`, `complex64`, or `complex128`.
`int8`, `int16`, `int32`, `int64`, `uint8`, or `complex64`.
* <b>`name`</b>: A name for the operation (optional).
@ -119,7 +119,7 @@ tf.ones_like(tensor) ==> [[1, 1, 1], [1, 1, 1]]
* <b>`tensor`</b>: A `Tensor`.
* <b>`dtype`</b>: A type for the returned `Tensor`. Must be `float32`, `float64`,
`int8`, `int16`, `int32`, `int64`, `uint8`, `complex64` or `complex128`.
`int8`, `int16`, `int32`, `int64`, `uint8`, or `complex64`.
* <b>`name`</b>: A name for the operation (optional).

View File

@ -3205,9 +3205,10 @@ and written to `output_dir`.
* <b>`output_dir`</b>: A string containing the directory to write a summary to.
* <b>`checkpoint_path`</b>: A string containing the path to a checkpoint to restore.
Can be `None` if the graph doesn't require loading any variables.
* <b>`eval_dict`</b>: A `dict` mapping string names to tensors to evaluate for in every
eval step.
* <b>`update_op`</b>: A 'Tensor' which is run before evaluating 'eval_dict'.
* <b>`eval_dict`</b>: A `dict` mapping string names to tensors to evaluate. It is
evaluated in every logging step. The result of the final evaluation is
returned. If update_op is None, then it's evaluated in every step.
* <b>`update_op`</b>: A `Tensor` which is run in every step.
* <b>`global_step_tensor`</b>: A `Variable` containing the global step. If `None`,
one is extracted from the graph using the same logic as in `Supervisor`.
Used to place eval summaries on training curves.
@ -3223,7 +3224,7 @@ and written to `output_dir`.
A tuple `(eval_results, global_step)`:
* <b>`eval_results`</b>: A `dict` mapping `string` to numeric values (`int`, `float`)
that are the eval results from the last step of the eval. None if no
that are the result of running eval_dict in the last step. `None` if no
eval steps were run.
* <b>`global_step`</b>: The global step this evaluation corresponds to.

View File

@ -19,9 +19,10 @@ and written to `output_dir`.
* <b>`output_dir`</b>: A string containing the directory to write a summary to.
* <b>`checkpoint_path`</b>: A string containing the path to a checkpoint to restore.
Can be `None` if the graph doesn't require loading any variables.
* <b>`eval_dict`</b>: A `dict` mapping string names to tensors to evaluate for in every
eval step.
* <b>`update_op`</b>: A 'Tensor' which is run before evaluating 'eval_dict'.
* <b>`eval_dict`</b>: A `dict` mapping string names to tensors to evaluate. It is
evaluated in every logging step. The result of the final evaluation is
returned. If update_op is None, then it's evaluated in every step.
* <b>`update_op`</b>: A `Tensor` which is run in every step.
* <b>`global_step_tensor`</b>: A `Variable` containing the global step. If `None`,
one is extracted from the graph using the same logic as in `Supervisor`.
Used to place eval summaries on training curves.
@ -37,7 +38,7 @@ and written to `output_dir`.
A tuple `(eval_results, global_step)`:
* <b>`eval_results`</b>: A `dict` mapping `string` to numeric values (`int`, `float`)
that are the eval results from the last step of the eval. None if no
that are the result of running eval_dict in the last step. `None` if no
eval steps were run.
* <b>`global_step`</b>: The global step this evaluation corresponds to.

View File

@ -1,11 +1,18 @@
### `tf.one_hot(indices, depth, on_value=1, off_value=0, axis=None, dtype=tf.float32, name=None)` {#one_hot}
### `tf.one_hot(indices, depth, on_value=None, off_value=None, axis=None, dtype=None, name=None)` {#one_hot}
Returns a one-hot tensor.
The locations represented by indices in `indices` take value `on_value`,
while all other locations take value `off_value`. By default, `on_value` is 1,
and `off_value` is 0. The type of the output tensor is specified by `dtype`,
which defaults to `tf.float32`.
while all other locations take value `off_value`.
`on_value` and `off_value` must have matching data types. If `dtype` is also
provided, they must be the same data type as specified by `dtype`.
If `on_value` is not provided, it will default to the value `1` with type
`dtype`
If `off_value` is not provided, it will default to the value `0` with type
`dtype`
If the input `indices` is rank `N`, the output will have rank `N+1`. The
new axis is created at dimension `axis` (default: the new axis is appended
@ -27,6 +34,13 @@ shape will be:
depth x batch x features if axis == 0
```
If `dtype` is not provided, it will attempt to assume the data type of
`on_value` or `off_value`, if one or both are passed in. If none of
`on_value`, `off_value`, or `dtype` are provided, `dtype` will default to the
value `tf.float32`
Note: If a non-numeric data type output is desired (tf.string, tf.bool, etc.),
both `on_value` and `off_value` _must_ be provided to `one_hot`
Examples
=========
@ -74,6 +88,22 @@ Then output is `[2 x 2 x 3]`:
]
```
Using default values for `on_value` and `off_value`:
```
indices = [0, 1, 2]
depth = 3
```
The output will be
```
output =
[[1., 0., 0.],
[0., 1., 0.],
[0., 0., 1.]]
```
##### Args:
@ -94,5 +124,6 @@ Then output is `[2 x 2 x 3]`:
##### Raises:
* <b>`TypeError`</b>: If dtype is `tf.string`
* <b>`TypeError`</b>: If dtype of either `on_value` or `off_value` don't match `dtype`
* <b>`TypeError`</b>: If dtype of `on_value` and `off_value` don't match one another

View File

@ -163,7 +163,7 @@ case where both types are quantized.
* <b>`value`</b>: A `Tensor` with type `float`, `double`, `int64`, `int32`, `uint8`,
`int16`, `int8`, `complex64` or `complex128`.
`int16`, `int8`, or `complex64`.
* <b>`bias`</b>: A 1-D `Tensor` with size matching the last dimension of `value`.
Must be the same type as `value` unless `value` is a quantized type,
in which case a different quantized type may be used.
@ -186,7 +186,7 @@ Specifically, `y = 1 / (1 + exp(-x))`.
##### Args:
* <b>`x`</b>: A Tensor with type `float`, `double`, `int32`, `complex64`, `complex128`, `int64`,
* <b>`x`</b>: A Tensor with type `float`, `double`, `int32`, `complex64`, `int64`,
or `qint32`.
* <b>`name`</b>: A name for the operation (optional).
@ -205,7 +205,7 @@ Computes hyperbolic tangent of `x` element-wise.
##### Args:
* <b>`x`</b>: A Tensor with type `float`, `double`, `int32`, `complex64`, `complex128`, `int64`,
* <b>`x`</b>: A Tensor with type `float`, `double`, `int32`, `complex64`, `int64`,
or `qint32`.
* <b>`name`</b>: A name for the operation (optional).