Convenience method to cast `self` to a `float32` Tensor. ```python exec="true" source="above" session="tensor" result="python" t = Tensor([-1, 2, 3], dtype=dtypes.int32) print(t.dtype, t.numpy()) ``` ```python exec="true" source="above" session="tensor" result="python"
(self)
| 33 | return dtypes.is_float(self.dtype.base) |
| 34 | |
| 35 | def float(self) -> Self: |
| 36 | """ |
| 37 | Convenience method to cast `self` to a `float32` Tensor. |
| 38 | |
| 39 | ```python exec="true" source="above" session="tensor" result="python" |
| 40 | t = Tensor([-1, 2, 3], dtype=dtypes.int32) |
| 41 | print(t.dtype, t.numpy()) |
| 42 | ``` |
| 43 | ```python exec="true" source="above" session="tensor" result="python" |
| 44 | t = t.float() |
| 45 | print(t.dtype, t.numpy()) |
| 46 | ``` |
| 47 | """ |
| 48 | return self.cast(dtypes.float32) |
| 49 | |
| 50 | def half(self) -> Self: |
| 51 | """ |