nn_reglu: ReGLU Module

nn_regluR Documentation

ReGLU Module

Description

Rectified Gated Linear Unit (ReGLU) module. Computes the output as \text{ReGLU}(x, g) = x \cdot \text{ReLU}(g) where \(x\) and \(g\) are created by splitting the input tensor in half along the last dimension.

Usage

nn_reglu()

References

Shazeer N (2020). “GLU Variants Improve Transformer.” 2002.05202, https://arxiv.org/abs/2002.05202.

Examples


x = torch::torch_randn(10, 10)
reglu = nn_reglu()
reglu(x)


mlr-org/mlr3torch documentation built on April 17, 2025, 8:22 p.m.