Convert the input `x` to a tensor of type `dtype`. Arguments: x: An object to be converted (numpy array, list, tensors). dtype: The destination type. Returns: A tensor.
(x, dtype)
| 669 | |
| 670 | |
| 671 | def _to_tensor(x, dtype): |
| 672 | """Convert the input `x` to a tensor of type `dtype`. |
| 673 | |
| 674 | Arguments: |
| 675 | x: An object to be converted (numpy array, list, tensors). |
| 676 | dtype: The destination type. |
| 677 | |
| 678 | Returns: |
| 679 | A tensor. |
| 680 | """ |
| 681 | return ops.convert_to_tensor(x, dtype=dtype) |
| 682 | |
| 683 | |
| 684 | @keras_export('keras.backend.is_sparse') |