torch.broadcast_to
-
torch.broadcast_to(input, shape) → Tensor -
Распространяет
inputна формуshape. Эквивалентно вызовуinput.expand(shape). Подробнее см.expand().- Параметры:
-
- input (Тензор) – входной тензор.
-
shape (список, кортеж или
torch.Size) – новая форма.
Пример:
>>> x = torch.tensor([1, 2, 3]) >>> torch.broadcast_to(x, (3, 3)) tensor([[1, 2, 3], [1, 2, 3], [1, 2, 3]])
© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/1.13/generated/torch.broadcast_to.html