torch.gcd
- torch.gcd(input, other, *, out=None) → Tensor
Computes the element-wise greatest common divisor (GCD) of
inputand.
Computes the element-wise greatest common divisor (GCD) of input and .
Both input and other must have integer types.
Example:
>>> a = torch.tensor([5, 10, 15])
>>> b = torch.tensor([3, 4, 5])
>>> torch.gcd(a, b)
tensor([1, 2, 5])
>>> c = torch.tensor([3])
>>> torch.gcd(a, c)
tensor([1, 1, 3])