torch.functional.broadcast_tensors
- torch.functional.broadcast_tensors(*tensors) → List of Tensors
Broadcasts the given tensors according to Broadcasting semantics.
- Parameters:
*tensors – any number of tensors of the same type
Broadcasts the given tensors according to Broadcasting semantics.
*tensors – any number of tensors of the same type
Example:
>>> x = torch.arange(3).view(1, 3)
>>> y = torch.arange(2).view(2, 1)
>>> a, b = torch.broadcast_tensors(x, y)
>>> a.size()
torch.Size([2, 3])
>>> a
tensor([[0, 1, 2],
[0, 1, 2]])