class_docstr: Gated Linear Unit activation proposed by https://arxiv.org/pdf/1612.08083.pdf
  
  Parameters
  ----------
  dim : int
      the dimension to split gate and activation
  nonlinear: bool (default True)
      if True apply a tanh to activation before applying gate
class_docstr_tok: ["Gated","Linear","Unit","activation","proposed","by","https",":","\/\/arxiv.org\/pdf\/1612.08083.pdf","Parameters","--","--","--","--","--","dim",":","int","the","dimension","to","split","gate","and","activation","nonlinear",":","bool","(","default","True",")","if","True","apply","a","tanh","to","activation","before","applying","gate"]
code: def forward(self, x: Tensor) -> Tensor:
      if x.size(self.dim) % 2 > 0:
          raise ValueError("The specified dimension must be even")
      val, gate = x.chunk(2, dim=self.dim)
      if self.nonlinear:
          val = pt.tanh(val)
      gate = pt.sigmoid(gate)
      return val * gate
  
file_path: gluonts/src/gluonts/nursery/daf/tslib/nn/activations.py
imports: from typing import List
  import math
  import torch
  from torch import Tensor, nn
label_desc: Use image node_id 2 for calling the GatedLinearUnit obj's underlying member method code with example usage: obj.forward(x) and returns: unknown