nn_glu {torch}R Documentation

GLU module

Description

Applies the gated linear unit function {GLU}(a, b)= a \otimes \sigma(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

Examples

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

[Package torch version 0.13.0 Index]