ttnn.conj

ttnn.conj(input_tensor: ComplexTensor, *, memory_config: ttnn.MemoryConfig = None) ttnn.Tensor

Returns complex conjugate value of complex tensor input_tensor.

Parameters:

input_tensor (ComplexTensor) – the input tensor.

Keyword Arguments:

memory_config (ttnn.MemoryConfig, optional) – Memory config for the operation. Defaults to None.

Returns:

ttnn.Tensor – the 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 complex conjugate
output = ttnn.conj(tensor, memory_config=ttnn.DRAM_MEMORY_CONFIG)
logger.info(f"Complex conjugate: {output}")