tensorflow_backend.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:keras_superpixel_pooling 作者: parag2489 项目源码 文件源码
def to_dense(tensor):
    """Converts a sparse tensor into a dense tensor and returns it.

    # Arguments
        tensor: A tensor instance (potentially sparse).

    # Returns
        A dense tensor.

    # Examples
    ```python
        >>> 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
"""
if is_sparse(tensor):
    return tf.sparse_tensor_to_dense(tensor)
else:
    return tensor

```

评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号