tf.keras.backend.to_dense
Stay organized with collections
Save and categorize content based on your preferences.
Converts a sparse tensor into a dense tensor and returns it.
tf.keras.backend.to_dense(
tensor
)
Arguments |
tensor
|
A tensor instance (potentially sparse).
|
Examples:
from keras import backend as K
b = K.placeholder((2, 2), sparse=True)
print(K.is_sparse(b))
True
c = K.to_dense(b)
print(K.is_sparse(c))
False
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.keras.backend.to_dense\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 2 version](/api_docs/python/tf/keras/backend/to_dense) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/backend.py#L708-L732) |\n\nConverts a sparse tensor into a dense tensor and returns it.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.keras.backend.to_dense`](/api_docs/python/tf/keras/backend/to_dense), \\`tf.compat.v2.keras.backend.to_dense\\`\n\n\u003cbr /\u003e\n\n tf.keras.backend.to_dense(\n tensor\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Arguments --------- ||\n|----------|-----------------------------------------|\n| `tensor` | A tensor instance (potentially sparse). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A dense tensor. ||\n\n\u003cbr /\u003e\n\n#### Examples:\n\n from keras import backend as K\n b = K.placeholder((2, 2), sparse=True)\n print(K.is_sparse(b))\n True\n c = K.to_dense(b)\n print(K.is_sparse(c))\n False"]]