TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tft.sparse_tensor_to_dense_with_shape

tft.sparse_tensor_to_dense_with_shape(
    x,
    shape,
    default_value=0
)

Converts a SparseTensor into a dense tensor and sets its shape.

Args:

  • x: A SparseTensor.
  • shape: The desired shape of the densified Tensor.
  • default_value: (Optional) Value to set for indices not specified. Defaults to zero.

Returns:

A Tensor with the desired shape.

Raises:

  • ValueError: If input is not a SparseTensor.