On this page
tf.keras.backend.to_dense
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
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/keras/backend/to_dense