triton.language.reshape

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

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

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

  • shape – 新的形状。

shape 可以作为元组传递,也可以作为单独的参数传递。

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

此函数也可以作为成员函数在 tensor 上调用,形式为 x.reshape(...) 而非 reshape(x, ...)