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), spar
(tensor)
| 683 | |
| 684 | @keras_export('keras.backend.is_sparse') |
| 685 | def is_sparse(tensor): |
| 686 | """Returns whether a tensor is a sparse tensor. |
| 687 | |
| 688 | Arguments: |
| 689 | tensor: A tensor instance. |
| 690 | |
| 691 | Returns: |
| 692 | A boolean. |
| 693 | |
| 694 | Example: |
| 695 | ```python |
| 696 | >>> from keras import backend as K |
| 697 | >>> a = K.placeholder((2, 2), sparse=False) |
| 698 | >>> print(K.is_sparse(a)) |
| 699 | False |
| 700 | >>> b = K.placeholder((2, 2), sparse=True) |
| 701 | >>> print(K.is_sparse(b)) |
| 702 | True |
| 703 | ``` |
| 704 | """ |
| 705 | return isinstance(tensor, sparse_tensor.SparseTensor) |
| 706 | |
| 707 | |
| 708 | @keras_export('keras.backend.to_dense') |
no outgoing calls
no test coverage detected