triton.language.reshape

triton.language.reshape(input, *shape, can_reorder=False)

返回一个与输入元素数量相同但具有指定形状的张量。

Parameters:
  • input (Block) – 输入张量。

  • shape – 新的形状。

shape 可以作为元组或单独参数传递:

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

此函数也可以作为成员函数在tensor上调用, 即使用x.reshape(...)而不是 reshape(x, ...)