![]() |
Converts a dense tensor into a sparse tensor.
Aliases:
tf.sparse.from_dense(
tensor,
name=None
)
Only elements not equal to zero will be present in the result. The resulting
SparseTensor
has the same dtype and shape as the input.
Args:
tensor
: A denseTensor
to be converted to aSparseTensor
.name
: Optional name for the op.
Returns:
The SparseTensor
.