torch.ldexp¶ torch.ldexp(input, other, *, out=None) → Tensor¶ 將 input 與 2 的 other 次冪相乘。 outi=inputi∗2iother\text{{out}}_i = \text{{input}}_i * 2^\text{{other}}_i outi=inputi∗2iother通常此函式用於將 input 中的尾數與根據 other 中的指數生成的 2 的整數次冪相乘,從而構造浮點數。 引數 input (Tensor) – 輸入張量。 other (Tensor) – 指數張量,通常為整數。 關鍵字引數 out (Tensor,可選) – 輸出張量。 示例 >>> torch.ldexp(torch.tensor([1.]), torch.tensor([1])) tensor([2.]) >>> torch.ldexp(torch.tensor([1.0]), torch.tensor([1, 2, 3, 4])) tensor([ 2., 4., 8., 16.])