RaggedTensorToTensor

public final class RaggedTensorToTensor

Create a dense tensor from a ragged tensor, possibly altering its shape.

The `ragged_to_dense` op creates a dense tensor from a list of row partition tensors, a value vector, and default values. If the shape is unspecified, the minimal shape required to contain all the elements in the ragged tensor (the natural shape) will be used. If some dimensions are left unspecified, then the size of the natural shape is used in that dimension.

The default_value will be broadcast to the output shape. After that, the values from the ragged tensor overwrite the default values. Note that the default_value must have less dimensions than the value.

The row partition tensors are in the order of the dimensions. At present, the types can be:

  • "ROW_SPLITS": the row_splits tensor from the ragged tensor.
  • "VALUE_ROWIDS": the value_rowids tensor from the ragged tensor.
  • "FIRST_DIM_SIZE": if value_rowids is used for the first dimension, then it is preceded by "FIRST_DIM_SIZE".

Constants

String OP_NAME The name of this op, as known by TensorFlow core engine

Public Methods

Output<U>
asOutput()
Returns the symbolic handle of the tensor.
static <U extends TType, V extends TNumber> RaggedTensorToTensor<U>
create(Scope scope, Operand<? extends TNumber> shape, Operand<U> values, Operand<U> defaultValue, Iterable<Operand<V>> rowPartitionTensors, List<String> rowPartitionTypes)
Factory method to create a class wrapping a new RaggedTensorToTensor operation.
Output<U>
result()
The resulting dense tensor.

Inherited Methods

Constants

public static final String OP_NAME

The name of this op, as known by TensorFlow core engine

Constant Value: "RaggedTensorToTensor"

Public Methods

public Output<U> asOutput ()

Returns the symbolic handle of the tensor.

Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.

public static RaggedTensorToTensor<U> create (Scope scope, Operand<? extends TNumber> shape, Operand<U> values, Operand<U> defaultValue, Iterable<Operand<V>> rowPartitionTensors, List<String> rowPartitionTypes)

Factory method to create a class wrapping a new RaggedTensorToTensor operation.

Parameters
scope current scope
shape The desired shape of the the output tensor. If left unspecified (empty), the minimal shape required to contain all the elements in the ragged tensor (the natural shape) will be used. If some dimensions are left unspecified, then the size of the natural shape is used in that dimension.

Note that dense dimensions cannot be modified by the shape argument. Trying to change the size of a dense dimension will cause the op to fail. Examples: natural shape: [4, 5, 6] shape: -1 output shape: [4, 5, 6]

natural shape: [4, 5, 6] shape: [3, -1, 2] output shape: [3, 5, 2]

natural shape: [4, 5, 6] shape: [3, 7, 2] output shape: [3, 7, 2]

values A 1D tensor representing the values of the ragged tensor.
defaultValue The default_value when the shape is larger than the ragged tensor. The default_value is broadcast until it is the shape of the output tensor, and then overwritten by values in the ragged tensor. The default value must be compatible with this broadcast operation, and must have fewer dimensions than the value tensor.
rowPartitionTypes The types of the row partition tensors. At present, these can be:
  • "ROW_SPLITS": the row_splits tensor from the ragged tensor.
  • "VALUE_ROWIDS": the value_rowids tensor from the ragged tensor.
  • "FIRST_DIM_SIZE": if value_rowids is used for the first dimension, then it is preceeded by "FIRST_DIM_SIZE". The tensors are in the order of the dimensions.
Returns
  • a new instance of RaggedTensorToTensor

public Output<U> result ()

The resulting dense tensor.