tf.keras.backend.to_dense

TensorFlow 1 version View source on GitHub

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

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