Class

org.platanios.tensorflow.api.ops

SparseOutput

Related Doc: package ops

Permalink

final case class SparseOutput(indices: Output, values: Output, denseShape: Output) extends OutputLike with Product with Serializable

Represents a sparse op output.

TensorFlow represents a sparse tensor as three separate dense tensors: indices, values, and denseShape. In Scala, the three tensors are collected into a SparseOutput class for ease of use. If you have separate indices, values, and denseShape tensors, wrap them in a SparseTensor object before passing to the relevant sparse tensor manipulation.

Concretely, the sparse tensor SparseOutput(indices, values, denseShape) comprises the following components, where N and rank are the number of values and number of dimensions in the SparseOutput, respectively:

The corresponding dense tensor, dense, satisfies:

dense.shape == denseShape
dense(indices(i)) = values(i) // Using a somewhat loose notation with respect to indexing.

IMPORTANT NOTE: By convention, indices should be sorted in row-major order (or equivalently lexicographic order on indices(i)). This is not enforced when SparseTensor objects are constructed, but most ops assume correct ordering. If the ordering of sparse tensor st is wrong, a fixed version can be obtained by calling sparseReorder(st).

For example, the sparse tensor SparseOutput(indices = 0], [1, 2, values = [1, 2], denseShape = [3, 4]), represents the dense tensor 0, 0, 0], [0, 0, 2, 0], [0, 0, 0, 0.

indices

Two-dimensional INT32 or INT64 tensor with shape [N, rank].

values

One-dimensional tensor with shape [N].

denseShape

One-dimensional INT32 or INT64 tensor with shape [rank].

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SparseOutput
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. OutputLike
  7. OutputConvertible
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SparseOutput(indices: Output, values: Output, denseShape: Output)

    Permalink

    indices

    Two-dimensional INT32 or INT64 tensor with shape [N, rank].

    values

    One-dimensional tensor with shape [N].

    denseShape

    One-dimensional INT32 or INT64 tensor with shape [rank].

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def consumers: Array[Input]

    Permalink

    Consumers of these indexed slices (i.e., ops that use this op output as one of their inputs).

    Consumers of these indexed slices (i.e., ops that use this op output as one of their inputs).

    Definition Classes
    SparseOutputOutputLike
  7. def dataType: types.DataType

    Permalink

    Data type of this sparse op output.

    Data type of this sparse op output.

    Definition Classes
    SparseOutputOutputLike
  8. val denseShape: Output

    Permalink

    One-dimensional INT32 or INT64 tensor with shape [rank].

  9. def device: String

    Permalink

    Device on which this sparse op output will be placed.

    Device on which this sparse op output will be placed.

    Definition Classes
    SparseOutputOutputLike
  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def graph: core.Graph

    Permalink

    Graph that contains values, indices, and denseShape.

    Graph that contains values, indices, and denseShape.

    Definition Classes
    SparseOutputOutputLike
  14. val indices: Output

    Permalink

    Two-dimensional INT32 or INT64 tensor with shape [N, rank].

  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. def name: String

    Permalink

    Name of this sparse op output.

    Name of this sparse op output.

    Definition Classes
    SparseOutputOutputLike
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. def op: Op

    Permalink

    Op that outputs this sparse tensor.

    Op that outputs this sparse tensor.

    Definition Classes
    SparseOutputOutputLike
  21. def shape: core.Shape

    Permalink

    Gets the Shape corresponding to the shape of the dense tensor that this sparse tensor represents.

    Gets the Shape corresponding to the shape of the dense tensor that this sparse tensor represents.

    returns

    Dense tensor shape.

  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  23. def toOutput(defaultValue: Output = 0, validateIndices: Boolean = true, name: String = s"${values.op.name}/ToOutput"): Output

    Permalink

    Converts this sparse tensor to a dense tensor.

    Converts this sparse tensor to a dense tensor.

    The constructed op builds a tensor dense with shape input.denseShape, such that:

    // If input.indices is scalar:
    dense(i) ==> (i == input.indices ? input.values : defaultValue)
    
    // If input.indices is a vector, then for each i:
    dense(input.indices(i)) ==> input.values(i)
    
    // If input.indices is an n by d matrix, then for each i in [0, n):
    dense(input.indices(i)(0), ..., input.indices(i)(d-1)) ==> input.values(i)

    All other values in dense are set to defaultValue. If input.values is a scalar, then all sparse indices are set to that single value.

    input.indices should be sorted in lexicographic order and they must not contain any repeats. If validateIndices is true, then these properties are checked during execution.

    defaultValue

    Scalar tensor with the same data type as input.values, containing the value set for indices that are not specified in input.indices.

    validateIndices

    If true, the indices in input.indices are checked to make sure that they are sorted in lexicographic order and that there are no repeats.

    name

    Name for the created op.

    returns

    Created op output, with the same data type as input.values and shape input.denseShape.

  24. def toOutput: Output

    Permalink

    Returns the Output that this OutputLike object represents.

    Returns the Output that this OutputLike object represents.

    Definition Classes
    SparseOutputOutputLikeOutputConvertible
  25. def toOutputIndexedSlices(optimize: Boolean = true): OutputIndexedSlices

    Permalink

    Returns an OutputIndexedSlices that has the same value as this OutputLike.

    Returns an OutputIndexedSlices that has the same value as this OutputLike.

    optimize

    Boolean flag indicating whether to optimize this conversion by using a constant op with the shape of this tensor at graph creation time (instead of execution time), if known.

    returns

    OutputIndexedSlices that has the same value as this OutputLike.

    Definition Classes
    SparseOutputOutputLike
    Annotations
    @throws( ... )
  26. def toString(): String

    Permalink
    Definition Classes
    SparseOutput → AnyRef → Any
  27. val values: Output

    Permalink

    One-dimensional tensor with shape [N].

  28. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from OutputLike

Inherited from OutputConvertible

Inherited from AnyRef

Inherited from Any

Ungrouped