pytorch中Math operation操作:torch.ger()
torch.
ger
(vec1, vec2, out=None) → Tensor
Outer product of vec1
and vec2
. If vec1
is a vector of size nn and vec2
is a vector of size mm, then out
must be a matrix of size (n×m).
Parameters: |
---|
Example:
>>> v1 = torch.arange(1., 5.)
>>> v2 = torch.arange(1., 4.)
>>> torch.ger(v1, v2)
tensor([[ 1., 2., 3.],
[ 2., 4., 6.],
[ 3., 6., 9.],
[ 4., 8., 12.]])
从例子以及描述可知,这是一个向量间外积的操作。
越努力,越幸运