Casts a tensor to type `bfloat16`. 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 `bfloat16`. Raises: TypeError: If `x` cannot
(x, name="ToBFloat16")
| 819 | @deprecation.deprecated(date=None, instructions="Use `tf.cast` instead.") |
| 820 | @tf_export(v1=["to_bfloat16"]) |
| 821 | def to_bfloat16(x, name="ToBFloat16"): |
| 822 | """Casts a tensor to type `bfloat16`. |
| 823 | |
| 824 | Args: |
| 825 | x: A `Tensor` or `SparseTensor` or `IndexedSlices`. |
| 826 | name: A name for the operation (optional). |
| 827 | |
| 828 | Returns: |
| 829 | A `Tensor` or `SparseTensor` or `IndexedSlices` with same shape as `x` with |
| 830 | type `bfloat16`. |
| 831 | |
| 832 | Raises: |
| 833 | TypeError: If `x` cannot be cast to the `bfloat16`. |
| 834 | """ |
| 835 | return cast(x, dtypes.bfloat16, name=name) |
| 836 | |
| 837 | |
| 838 | @deprecation.deprecated(date=None, instructions="Use `tf.cast` instead.") |