torch_hypot function

Hypot

Hypot

torch_hypot(self, other)

Arguments

  • self: (Tensor) the first input tensor
  • other: (Tensor) the second input tensor

hypot(input, other, *, out=None) -> Tensor

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

\mboxouti=\mboxinputi2+\mboxotheri2 \mbox{out}_{i} = \sqrt{\mbox{input}_{i}^{2} + \mbox{other}_{i}^{2}}

The shapes of input and other must be broadcastable .

Examples

if (torch_is_installed()) { torch_hypot(torch_tensor(c(4.0)), torch_tensor(c(3.0, 4.0, 5.0))) }
  • Maintainer: Daniel Falbel
  • License: MIT + file LICENSE
  • Last published: 2025-02-14