Rate this Page
★★★★★
torch.outer#
- torch.outer(input,vec2,*,out=None)→Tensor#
Outer product of
inputandvec2.Ifinputis a vector of size andvec2is a vector ofsize, thenoutmust be a matrix of size.Note
This function does notbroadcast.
- Parameters:
- Keyword Arguments:
out (Tensor,optional) – optional output matrix
Example:
>>>v1=torch.arange(1.,5.)>>>v2=torch.arange(1.,4.)>>>torch.outer(v1,v2)tensor([[ 1., 2., 3.], [ 2., 4., 6.], [ 3., 6., 9.], [ 4., 8., 12.]])
On this page