oneflow.broadcast_to¶
-
oneflow.broadcast_to(input, shape) → Tensors¶ The interface is consistent with PyTorch. The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.broadcast_to.html.
Broadcasts
inputto the shapeshape. Equivalent to callinginput.expand(shape). Seeoneflow.expand()for details.- Parameters
input (oneflow.Tensor) – the input tensor.
shape (list, tuple, or oneflow.Size) – the new shape.
Example:
>>> import oneflow as flow >>> x = flow.tensor([1, 2, 3]) >>> flow.broadcast_to(x, (3, 3)) tensor([[1, 2, 3], [1, 2, 3], [1, 2, 3]], dtype=oneflow.int64)