torch.gcd
-
torch.gcd(input, other, *, out=None) → Tensor -
Вычисляет элемент-поэлементное наибольшее общее делитель (НОД)
inputиother.И
inputиotherдолжны иметь целочисленный тип.Примечание
Это определяет .
- Параметры:
- Ключевые аргументы:
-
out (Tensor, необязательно) – выходной тензор.
Пример:
>>> 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])
© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/1.13/generated/torch.gcd.html