Function glu

pub fn glu<const D: usize, B>(tensor: Tensor<B, D>, dim: usize) -> Tensor<B, D>
where B: Backend,
Expand description

Applies the gated linear unit function.

GLU(a,b)=a⊗σ(b) where a is the first half of the input matrices and b is the second half.

Note:

  • The size of the input tensor along dim must be divisible by 2.

§Arguments

  • tensor - The input tensor.

§Returns

  • A tensor with the same shape as the input, except the size along dim is halved.