Class IndexedSlices
A sparse representation of a set of tensor slices at given indices.
Aliases:
- Class
tf.compat.v1.IndexedSlices
- Class
tf.compat.v2.IndexedSlices
This class is a simple wrapper for a pair ofTensor
objects: values
: ATensor
of any dtype with shape[D0, D1, ..., Dn]
.indices
: A 1-D integerTensor
with shape[D0]
. AnIndexedSlices
is typically used to represent a subset of a larger tensordense
of shape[LARGE0, D1, .. , DN]
whereLARGE0 >> D0
. The values inindices
are theindices
in the first dimension of the slices that have been extracted from the larger tensor. Thedense
tensordense
represented by anIndexedSlices
slices
has
dense[slices.indices[i], :, :, :, ...] = slices.values[i, :, :, :, ...]
tf.gatherThe IndexedSlices class is used principally in the definition of gradients for operations that have sparse gradients (e.g. ).
tf.SparseTensorContrast this representation with , which uses multi-dimensional indices and scalar values.
init
__init__(
values,
indices,
dense_shape=None
)
Creates an IndexedSlices
.
Properties
dense_shape
A 1-D Tensor
containing the shape of the corresponding dense tensor.
device
The name of the device on which values
will be produced, or None
.
dtype
The DType
of elements in this tensor.
graph
The Graph
that contains the values, indices, and shape tensors.
indices
A 1-D Tensor
containing the indices of the slices.
name
The name of this IndexedSlices
.
op
The Operation
that produces values
as an output.
values
A Tensor
containing the values of the slices.
Methods
neg
__neg__()
consumers
consumers()