Shortcuts

torch.hypot

torch.hypot(input, other, *, out=None) → Tensor

Given the legs of a right triangle, return its hypotenuse.

outi=inputi2+otheri2\text{out}_{i} = \sqrt{\text{input}_{i}^{2} + \text{other}_{i}^{2}}

The shapes of input and other must be broadcastable.

Parameters
  • input (Tensor) – the first input tensor

  • other (Tensor) – the second input tensor

Keyword Arguments

out (Tensor, optional) – the output tensor.

Example:

>>> a = torch.hypot(torch.tensor([4.0]), torch.tensor([3.0, 4.0, 5.0]))
tensor([5.0000, 5.6569, 6.4031])

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