ttnn.real
- ttnn.real(input_tensor: ComplexTensor, *, memory_config: ttnn.MemoryConfig = None) ttnn.Tensor
-
Performs complex operations for real of
input_tensor.- Parameters:
-
input_tensor (ComplexTensor)the input tensor.
- Keyword Arguments:
-
memory_config (ttnn.MemoryConfig, optional)Memory configuration of the returned component. Defaults to None, which leaves the component where it is.
Note
The result is the component of
input_tensoritself, so a request the component already satisfies returns it without a copy. A host component cannot be moved by a device operation and is returned unchanged whatever is requested.- Returns:
-
ttnn.Tensorthe output tensor.
Example
# Create a complex tensor real_part = torch.rand([1, 1, 32, 32], dtype=torch.bfloat16) imag_part = torch.rand([1, 1, 32, 32], dtype=torch.bfloat16) tensor = ttnn.complex_tensor( ttnn.Tensor(real_part, ttnn.bfloat16).to(ttnn.TILE_LAYOUT).to(device), ttnn.Tensor(imag_part, ttnn.bfloat16).to(ttnn.TILE_LAYOUT).to(device), ) # Get the real part output = ttnn.real(tensor, memory_config=ttnn.DRAM_MEMORY_CONFIG) logger.info(f"Real part: {output}")