torch.lcm¶ torch.lcm(input, other, *, out=None) → Tensor¶ 計算 input 和 other 的元素級最小公倍數 (LCM)。 input 和 other 必須都具有整數類型。 注意 這定義了 lcm(0,0)=0lcm(0, 0) = 0lcm(0,0)=0 以及 lcm(0,a)=0lcm(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])