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/2.1/generated/torch.gcd.html