IndexedSlices
Defined in tensorflow/python/framework/ops.py.
See the guide: Variables > Sparse Variable Updates
A sparse representation of a set of tensor slices at given indices.
This class is a simple wrapper for a pair of Tensor objects:
values: A Tensor of any dtype with shape [D0, D1, ..., Dn].indices: A 1-D integer Tensor with shape [D0].An IndexedSlices is typically used to represent a subset of a larger tensor dense of shape [LARGE0, D1, .. , DN] where LARGE0 >> D0. The values in indices are the indices in the first dimension of the slices that have been extracted from the larger tensor.
The dense tensor dense represented by an IndexedSlices slices has
dense[slices.indices[i], :, :, :, ...] = slices.values[i, :, :, :, ...]
The IndexedSlices class is used principally in the definition of gradients for operations that have sparse gradients (e.g. tf.gather).
Contrast this representation with tf.SparseTensor, which uses multi-dimensional indices and scalar values.
dense_shapeA 1-D Tensor containing the shape of the corresponding dense tensor.
deviceThe name of the device on which values will be produced, or None.
dtypeThe DType of elements in this tensor.
graphThe Graph that contains the values, indices, and shape tensors.
indicesA 1-D Tensor containing the indices of the slices.
nameThe name of this IndexedSlices.
opThe Operation that produces values as an output.
valuesA Tensor containing the values of the slices.
__init____init__(
values,
indices,
dense_shape=None
)
Creates an IndexedSlices.
__neg____neg__()
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/IndexedSlices