torch.broadcast_shapes
- 
torch.broadcast_shapes(*shapes) → Size[source]
- 
Similar to broadcast_tensors()but for shapes.This is equivalent to torch.broadcast_tensors(*map(torch.empty, shapes))[0].shapebut avoids the need create to intermediate tensors. This is useful for broadcasting tensors of common batch shape but different rightmost shape, e.g. to broadcast mean vectors with covariance matrices.Example: >>> torch.broadcast_shapes((2,), (3, 1), (1, 1, 1)) torch.Size([1, 3, 2]) - Parameters
- 
*shapes (torch.Size) – Shapes of tensors. 
- Returns
- 
A shape compatible with all input shapes. 
- Return type
- 
shape (torch.Size) 
- Raises
- 
RuntimeError – If shapes are incompatible. 
 
    © 2019 Torch Contributors
Licensed under the 3-clause BSD License.
    https://pytorch.org/docs/1.8.0/generated/torch.broadcast_shapes.html