Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tf.keras.backend.to_dense

TensorFlow 1 version View source on GitHub

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

tf.keras.backend.to_dense(
    tensor
)

Arguments:

  • tensor: A tensor instance (potentially sparse).

Returns:

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