triton.language.broadcast_to
- triton.language.broadcast_to(input, *shape, _semantic=None)
尝试将给定的张量广播(broadcast)为新的
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, ...)。