Casts a tensor to type `float32`. Args: x: A `Tensor` or `SparseTensor` or `IndexedSlices`. name: A name for the operation (optional). Returns: A `Tensor` or `SparseTensor` or `IndexedSlices` with same shape as `x` with type `float32`. Raises: TypeError: If `x` cannot be
(x, name="ToFloat")
| 743 | @deprecation.deprecated(date=None, instructions="Use `tf.cast` instead.") |
| 744 | @tf_export(v1=["to_float"]) |
| 745 | def to_float(x, name="ToFloat"): |
| 746 | """Casts a tensor to type `float32`. |
| 747 | |
| 748 | Args: |
| 749 | x: A `Tensor` or `SparseTensor` or `IndexedSlices`. |
| 750 | name: A name for the operation (optional). |
| 751 | |
| 752 | Returns: |
| 753 | A `Tensor` or `SparseTensor` or `IndexedSlices` with same shape as `x` with |
| 754 | type `float32`. |
| 755 | |
| 756 | Raises: |
| 757 | TypeError: If `x` cannot be cast to the `float32`. |
| 758 | """ |
| 759 | return cast(x, dtypes.float32, name=name) |
| 760 | |
| 761 | |
| 762 | @deprecation.deprecated(date=None, instructions="Use `tf.cast` instead.") |