ttnn.bitcast

ttnn.bitcast = FastOperation(python_fully_qualified_name='ttnn.bitcast', function=<ttnn._ttnn.operations.unary.bitcast_t object>, preprocess_golden_function_inputs=<function default_preprocess_golden_function_inputs>, golden_function=<function register_ttnn_cpp_unary_function.<locals>._golden_function>, postprocess_golden_function_outputs=<function default_postprocess_golden_function_outputs>, is_cpp_operation=True, is_experimental=False)

Bitcast reinterprets the bit pattern without conversion (unlike typecast which converts values).

Parameters:
  • input_tensor (ttnn.Tensor) – the input tensor.

  • dtype (ttnn.DataType) – output data type. Must have the same bit size as input dtype. Supported pairs: UINT16 <-> BFLOAT16 (both 16 bits), UINT32 <-> FLOAT32 (both 32 bits), UINT32 <-> INT32 (both 32 bits).

Keyword Arguments:
  • memory_config (ttnn.MemoryConfig, optional) – Memory configuration for the operation. Defaults to None.

  • output_tensor (ttnn.Tensor, optional) – preallocated output tensor. Defaults to None.

Returns:

ttnn.Tensor – the output tensor.

Note

Supported dtypes and layouts:

Dtypes

Layouts

BFLOAT16, FLOAT32, INT32, UINT16, UINT32

TILE, ROW_MAJOR