Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

nn_glu

GLU module


Description

Applies the gated linear unit function {GLU}(a, b)= a \otimes σ(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: (\ast_1, N, \ast_2) where * means, any number of additional dimensions

  • Output: (\ast_1, M, \ast_2) where M=N/2

Examples

if (torch_is_installed()) {
m <- nn_glu()
input <- torch_randn(4, 2)
output <- m(input)

}

torch

Tensors and Neural Networks with 'GPU' Acceleration

v0.3.0
MIT + file LICENSE
Authors
Daniel Falbel [aut, cre, cph], Javier Luraschi [aut], Dmitriy Selivanov [ctb], Athos Damiani [ctb], Christophe Regouby [ctb], Krzysztof Joachimiak [ctb], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.