ttnn.alt_complex_rotate90

ttnn.alt_complex_rotate90(input_tensor: ttnn.Tensor, *, memory_config: ttnn.MemoryConfig = None, output_tensor: ttnn.Tensor = None) ttnn.Tensor

Applies alt_complex_rotate90 to input_tensor element-wise.

\[(\mathrm{{output\_tensor}}_{2i}, \mathrm{{output\_tensor}}_{2i+1}) = (-\mathrm{{input\_tensor}}_{2i+1}, \mathrm{{input\_tensor}}_{2i})\]
Parameters:

input_tensor (ttnn.Tensor) – the input tensor. FLOAT32, BFLOAT16, BFLOAT8_B, BFLOAT4_B

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, layouts, and ranks:

Dtypes

Layouts

Ranks

TILE

2, 3, 4

The last dimension of the input tensor must be even.

Example

# Create a tensor with alternating complex layout (even last dimension required)
tensor = ttnn.from_torch(
    torch.rand([1, 1, 32, 64], dtype=torch.bfloat16),
    layout=ttnn.TILE_LAYOUT,
    device=device,
)

# Rotate complex values by 90 degrees in alternating format
output = ttnn.alt_complex_rotate90(tensor)
logger.info(f"Complex rotated by 90 degrees: {output}")