Shortcuts

torch.ger

torch.ger(input, vec2, out=None) → Tensor

Outer product of input and vec2. If input is a vector of size nn and vec2 is a vector of size mm , then out must be a matrix of size (n×m)(n \times m) .

Note

This function does not broadcast.

Parameters
  • input (Tensor) – 1-D input vector

  • vec2 (Tensor) – 1-D input vector

  • out (Tensor, optional) – optional output matrix

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.]])

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources