torch.outer
- torch.outer(input, vec2, *, out=None) → Tensor
Outer product of
inputand. If is a vector of size and is a vector of size , then must be a matrix of size .
Outer product of input and .
If is a vector of size and is a vector of
size , then must be a matrix of size .
inputvec2outExample:
>>> 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.]])