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, optional) – 輸出張量 (可選)。 範例 >>> 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.])