入门指南
Python API
broadcast_to()
Triton MLIR 方言
编程指南
尝试将给定张量广播到新的 shape。
shape
input (Block) – 输入张量。
shape – 目标形状。
shape 可以作为元组或单独参数传递
# These are equivalent broadcast_to(x, (32, 32)) broadcast_to(x, 32, 32)
此函数也可以作为成员函数在 tensor 上调用,形式为 x.broadcast_to(...),而不是 broadcast_to(x, ...)。
tensor
x.broadcast_to(...)
broadcast_to(x, ...)