Spec-Zone.ru › PyTorch 1

torch.gcd

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

Вычисляет элемент-поэлементное наибольшее общее делитель (НОД) input и other.

И input и other должны иметь целочисленный тип.

Примечание

Это определяет gcd(0,0)=0gcd(0, 0) = 0.

Параметры:
  • input (Tensor) – входной тензор.
  • other (Tensor) – второй входной тензор
Ключевые аргументы:

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

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API