triton.language.view

triton.language.view(input, *shape)

Returns a tensor with the same elements as input but a different shape. The order of the elements may not be preserved.

Parameters:
  • input (Block) – The input tensor.

  • shape – The desired shape.

shape can be passed as a tuple or as individual parameters:

# These are equivalent
view(x, (32, 32))
view(x, 32, 32)

This function can also be called as a member function on tensor, as x.view(...) instead of view(x, ...).