Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added several 'see also' references in Python API documentation #37616

Merged
merged 7 commits into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 18 additions & 2 deletions tensorflow/python/ops/array_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ def reshape(tensor, shape, name=None): # pylint: disable=redefined-outer-name
def fill(dims, value, name=None):
r"""Creates a tensor filled with a scalar value.

See also `tf.ones`, `tf.zeros`, `tf.one_hot`, `tf.eye`.

This operation creates a tensor of shape `dims` and fills it with `value`.

For example:
Expand Down Expand Up @@ -535,7 +537,7 @@ def shape_v2(input, out_type=dtypes.int32, name=None):
# pylint: disable=redefined-builtin
"""Returns the shape of a tensor.

See also `tf.size`.
See also `tf.size`, `tf.rank`.

This operation returns a 1-D integer tensor representing the shape of `input`.
This represents the minimal set of known information at definition time.
Expand Down Expand Up @@ -759,6 +761,8 @@ def rank(input, name=None):
# pylint: disable=redefined-builtin
"""Returns the rank of a tensor.

See also `tf.shape`.

Returns a 0-D `int32` `Tensor` representing the rank of `input`.

For example:
Expand Down Expand Up @@ -990,6 +994,8 @@ def slice(input_, begin, size, name=None):
# pylint: disable=redefined-builtin
"""Extracts a slice from a tensor.

See also `tf.strided_slice`.

This operation extracts a slice of size `size` from a tensor `input_` starting
at the location specified by `begin`. The slice `size` is represented as a
tensor shape, where `size[i]` is the number of elements of the 'i'th dimension
Expand Down Expand Up @@ -1052,6 +1058,8 @@ def strided_slice(input_,
name=None):
"""Extracts a strided slice of a tensor (generalized python array indexing).

See also `tf.slice`.

**Instead of calling this op directly most users will want to use the
NumPy-style slicing syntax (e.g. `tensor[..., 3:4:-1, tf.newaxis, 3]`), which
is supported via `tf.Tensor.__getitem__` and `tf.Variable.__getitem__`.**
Expand Down Expand Up @@ -1794,6 +1802,8 @@ def sparse_mask(a, mask_indices, name=None):
def unique(x, out_idx=dtypes.int32, name=None):
"""Finds unique elements in a 1-D tensor.

See also `tf.unique_with_counts`.

This operation returns a tensor `y` containing all of the unique elements
of `x` sorted in the same order that they occur in `x`. This operation
also returns a tensor `idx` the same size as `x` that contains the index
Expand Down Expand Up @@ -1839,6 +1849,8 @@ def unique(x, out_idx=dtypes.int32, name=None):
def unique_with_counts(x, out_idx=dtypes.int32, name=None):
"""Finds unique elements in a 1-D tensor.

See also `tf.unique`.

This operation returns a tensor `y` containing all of the unique elements
of `x` sorted in the same order that they occur in `x`. This operation
also returns a tensor `idx` the same size as `x` that contains the index
Expand Down Expand Up @@ -2686,6 +2698,8 @@ def wrapped(*args, **kwargs):
def zeros(shape, dtype=dtypes.float32, name=None):
"""Creates a tensor with all elements set to zero.

See also `tf.zeros_like`, `tf.ones`, `tf.fill`, `tf.eye`.

This operation returns a tensor of type `dtype` with shape `shape` and
all elements set to zero.

Expand Down Expand Up @@ -2935,7 +2949,7 @@ def ones_like_impl(tensor, dtype, name, optimize=True):
def ones(shape, dtype=dtypes.float32, name=None):
"""Creates a tensor with all elements set to one (1).

See also `tf.ones_like`.
See also `tf.ones_like`, `tf.zeros`, `tf.fill`, `tf.eye`.

This operation returns a tensor of type `dtype` with shape `shape` and
all elements set to one.
Expand Down Expand Up @@ -3860,6 +3874,8 @@ def one_hot(indices,
name=None):
"""Returns a one-hot tensor.

See also `tf.fill`, `tf.eye`.

The locations represented by indices in `indices` take value `on_value`,
while all other locations take value `off_value`.

Expand Down
2 changes: 2 additions & 0 deletions tensorflow/python/ops/functional_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ def scan(fn,
name=None):
"""scan on the list of tensors unpacked from `elems` on dimension 0.

See also `tf.map_fn`.

The simplest version of `scan` repeatedly applies the callable `fn` to a
sequence of elements from first to last. The elements are made of the tensors
unpacked from `elems` on dimension 0. The callable fn takes two tensors as
Expand Down
2 changes: 2 additions & 0 deletions tensorflow/python/ops/linalg_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def eye(num_rows,
name=None):
"""Construct an identity matrix, or a batch of matrices.

See also `tf.ones`, `tf.zeros`, `tf.fill`, `tf.one_hot`.

```python
# Construct one identity matrix.
tf.eye(2)
Expand Down
2 changes: 2 additions & 0 deletions tensorflow/python/ops/map_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def map_fn(fn,
fn_output_signature=None):
"""Transforms `elems` by applying `fn` to each element unstacked on axis 0.

See also `tf.scan`.

`map_fn` unstacks `elems` on axis 0 to obtain a sequence of elements;
calls `fn` to transform each element; and then stacks the transformed
values back together.
Expand Down