Spec-Zone.ru › PyTorch 2.14

torch.lcm

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

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

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

Примечание

Здесь определено, что lcm(0,0)=0lcm(0, 0) = 0 и lcm(0,a)=0lcm(0, a) = 0.

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

out (Tensor, optional) – выходной тензор.

Пример:

>>> a = torch.tensor([5, 10, 15])
>>> b = torch.tensor([3, 4, 5])
>>> torch.lcm(a, b)
tensor([15, 20, 15])
>>> c = torch.tensor([3])
>>> torch.lcm(a, c)
tensor([15, 30, 15])

© 2026, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.14/generated/torch.lcm.html

Spec-Zone.ru

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