mindspore.Tensor.byte
- Tensor.byte()[source]
Converts input tensor dtype to uint8.
- Returns
Tensor, converted to the uint8 dtype.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import numpy as np >>> import mindspore >>> from mindspore import Tensor >>> input_x = Tensor(np.ones([2,2]), mindspore.float32) >>> output = input_x.byte() >>> print(output.dtype) uint8