ttnn.reshape
- ttnn.reshape() ttnn.Tensor
-
- Note: for a 0 cost view, the following conditions must be met:
-
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.
:keyword *
memory_config
: Memory Config of the output tensor. Default is to match input tensor memory config :keyword *queue_id
: command queue id. Default is 0. :keyword *pad_value
: Value to pad the output tensor. Default is 0 :kwtype *pad_value
: number- Returns:
-
ttnn.Tensor – the output tensor with the new shape.
Example
>>> tensor = ttnn.from_torch(torch.tensor((1, 4), dtype=torch.bfloat16), device=device) >>> output = ttnn.reshape(tensor, (1, 1, 2, 2))