torch.nn.functional.glu¶ torch.nn.functional.glu(input, dim=-1) → Tensor[原始碼][原始碼]¶ Gated Linear Unit (GLU)。計算公式如下: GLU(a,b)=a⊗σ(b)\text{GLU}(a, b) = a \otimes \sigma(b) GLU(a,b)=a⊗σ(b)其中 input 沿著 dim 維度被分割成兩半,形成 a 和 b。σ\sigmaσ 是 sigmoid 函數,⊗\otimes⊗ 是矩陣的逐元素乘積。 參見 Language Modeling with Gated Convolutional Networks。 參數 input (Tensor) – 輸入張量 dim (int) – 分割輸入的維度。預設值:-1 回傳類型 Tensor