tensorflow_backend.py 文件源码

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

项目:deep-learning-keras-projects 作者: jasmeetsb 项目源码 文件源码
def is_sparse(tensor):
    """Returns whether a tensor is a sparse tensor.

    # Arguments
        tensor: A tensor instance.

    # Returns
        A boolean.

    # Example
    ```python
        >>> from keras import backend as K
        >>> a = K.placeholder((2, 2), sparse=False)
        >>> print(K.is_sparse(a))
        False
        >>> b = K.placeholder((2, 2), sparse=True)
        >>> print(K.is_sparse(b))
        True
"""
return isinstance(tensor, tf.SparseTensor)

```

评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号