入门
Python API
reshape()
Triton MLIR Dialects
编程指南
返回一个张量,其元素数量与输入相同,但具有提供的形状。
input (Block) – 输入张量。
shape – 新的形状。
shape 可以作为元组或单独的参数传递
shape
# These are equivalent reshape(x, (32, 32)) reshape(x, 32, 32)
此函数也可以作为成员函数在 tensor 上调用,写作 x.reshape(...) 而非 reshape(x, ...)。
tensor
x.reshape(...)
reshape(x, ...)