ttnn.view
- ttnn.view() ttnn.Tensor
-
This is a 0 cost view operation that returns the same tensor that was passed to it but with a new shape
- Note: The following conditions must be met:
-
the memory is stored on the device
the last dimension must not change
In Tiled the second last two dimensions must not change OR there is no padding on the second last dimension
- Parameters:
-
input_tensor (*) – Input Tensor.
new_shape (*) – New shape of tensor.
- Returns:
-
ttnn.Tensor – a reference to the input tensor but with the new shape.
Example
>>> tensor = ttnn.from_torch(torch.tensor((2, 1, 1, 1, 4), dtype=torch.bfloat16), device=device) >>> output = ttnn.view(tensor, (2, 1, 4))