Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


torch (version 0.2.1)

nn_glu: GLU module

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.

Usage

nn_glu(dim = -1)

Arguments

dim

(int): the dimension on which to split the input. Default: -1

Shape

  • Input: (1,N,2) where * means, any number of additional dimensions

  • Output: (1,M,2) where M=N/2

Examples

Run this code
# NOT RUN {
if (torch_is_installed()) {
m <- nn_glu()
input <- torch_randn(4, 2)
output <- m(input)

}
# }

Run the code above in your browser using DataLab