tf.keras.backend.to_dense

Converts a sparse tensor into a dense tensor and returns it.

Compat aliases for migration

See Migration guide for more details.

tf.compat.v1.keras.backend.to_dense

tensor A tensor instance (potentially sparse).

A dense tensor.

Examples:

b = tf.keras.backend.placeholder((2, 2), sparse=True)
print(tf.keras.backend.is_sparse(b))
True
c = tf.keras.backend.to_dense(b)
print(tf.keras.backend.is_sparse(c))
False