# glu¶

paddle.fluid.nets. glu ( input, dim=- 1 ) [source]

api_attr

Static Graph

The Gated Linear Units(GLU) composed by api_fluid_layers_split , api_fluid_layers_sigmoid and api_fluid_layers_elementwise_mul . Specifically, GLU will plit the input into two equal-sized parts, $$a$$ and $$b$$, along the given dimension and then compute as following:

${GLU}(a, b)= a \otimes \sigma(b)$
Args:
input (Variable): The input variable which is a Tensor or LoDTensor.

The supported data types include float32, float64 and float16 (only for GPU).

dim (int, optional): The dimension along which to split. If $$dim < 0$$, the

dimension to split along is $$rank(input) + dim$$. Default -1.

Returns:

Variable: Variable with half the size and same data type of input.

Examples:
import paddle.fluid as fluid