ttnn.polar_bw
- ttnn.polar_bw(grad_tensor: ComplexTensor, input_tensor: ComplexTensor, *, memory_config: ttnn.MemoryConfig) List of ttnn.Tensor
-
Performs backward operations for complex polar function on
input_tensorwith givengrad_tensor.- Parameters:
-
grad_tensor (ComplexTensor) – the input tensor.
input_tensor (ComplexTensor) – the input tensor.
- Keyword Arguments:
-
memory_config (ttnn.MemoryConfig) – Memory configuration for the operation.
- Returns:
-
List of ttnn.Tensor – the output tensor.
Note
Supported dtypes, layouts, and ranks:
Dtypes
Layouts
Ranks
BFLOAT16
TILE
2, 3, 4
Example
# Create sample tensors for backward polar coordinate operation # Create complex input tensor input_real = torch.rand([1, 1, 32, 32], dtype=torch.bfloat16) input_imag = torch.rand([1, 1, 32, 32], dtype=torch.bfloat16) input_tensor = ttnn.complex_tensor( ttnn.Tensor(input_real, ttnn.bfloat16).to(ttnn.TILE_LAYOUT).to(device), ttnn.Tensor(input_imag, ttnn.bfloat16).to(ttnn.TILE_LAYOUT).to(device), ) # Create complex gradient tensor grad_real = torch.rand([1, 1, 32, 32], dtype=torch.bfloat16) grad_imag = torch.rand([1, 1, 32, 32], dtype=torch.bfloat16) grad_tensor = ttnn.complex_tensor( ttnn.Tensor(grad_real, ttnn.bfloat16).to(ttnn.TILE_LAYOUT).to(device), ttnn.Tensor(grad_imag, ttnn.bfloat16).to(ttnn.TILE_LAYOUT).to(device), ) # Call the polar_bw function output = ttnn.polar_bw(grad_tensor, input_tensor, memory_config=ttnn.DRAM_MEMORY_CONFIG) logger.info(f"Polar Backward: {output}")