ttnn.typecast
- ttnn.typecast() ttnn.Tensor
-
Applies typecast to
input_tensor.:param *
input_tensor: input tensors must be on device, in ROW MAJOR or TILE layout :type *input_tensor: ttnn.Tensor :param *dtype: data type must be one of the following types BFLOAT16,BFLOAT8_B,BFLOAT4_B,UINT32,INT32 and UINT16. :type *dtype: Optional[ttnn.DataType] :param *::keyword *
memory_config: Memory configuration for the operation. :kwtype *memory_config: Optional[ttnn.MemoryConfig] :keyword *output_tensor: Preallocated tensor to store the output. :kwtype *output_tensor: Optional[ttnn.Tensor]- Returns:
-
ttnn.Tensor – The tensor with the updated data type. Output tensor will be on device, in same layout, and have the given data type.
Example:
>>> tensor = ttnn.typecast(torch.randn((10, 3, 32, 32), dtype=ttnn.bfloat16), ttnn.uint16)