class_docstr: This function implements a complex-valued Light GRU (liGRU).
  
  Ligru is single-gate GRU model based on batch-norm + relu
  activations + recurrent dropout. For more info see:
  
  "M. Ravanelli, P. Brakel, M. Omologo, Y. Bengio,
  Light Gated Recurrent Units for Speech Recognition,
  in IEEE Transactions on Emerging Topics in Computational Intelligence,
  2018" (https://arxiv.org/abs/1803.10225)
  
  To speed it up, it is compiled with the torch just-in-time compiler (jit)
  right before using it.
  
  It accepts in input tensors formatted as (batch, time, fea).
  In the case of 4d inputs like (batch, time, fea, channel) the tensor is
  flattened as (batch, time, fea*channel).
  
  Arguments
  ---------
  hidden_size : int
      Number of output neurons (i.e, the dimensionality of the output).
      Specified value is in term of complex-valued neurons. Thus, the output
      is 2*hidden_size.
  nonlinearity : str
       Type of nonlinearity (tanh, relu).
  normalization : str
       Type of normalization for the ligru model (batchnorm, layernorm).
       Every string different from batchnorm and layernorm will result
       in no normalization.
  num_layers : int
       Number of layers to employ in the RNN architecture.
  bias : bool
      If True, the additive bias b is adopted.
  dropout : float
      It is the dropout factor (must be between 0 and 1).
  return_hidden : bool
      If True, the function returns the last hidden layer.
  bidirectional : bool
      If True, a bidirectional model that scans the sequence both
      right-to-left and left-to-right is used.
  init_criterion : str , optional
      (glorot, he).
      This parameter controls the initialization criterion of the weights.
      It is combined with weights_init to build the initialization method of
      the complex-valued weights (default "glorot").
  weight_init : str, optional
      (complex, unitary).
      This parameter defines the initialization procedure of the
      complex-valued weights (default "complex"). "complex" will generate random complex-valued
      weights following the init_criterion and the complex polar form.
      "unitary" will normalize the weights to lie on the unit circle.
      More details in: "Deep Complex Networks", Trabelsi C. et al.
  
  Example
  -------
  >>> inp_tensor = torch.rand([10, 16, 30])
  >>> rnn = CLiGRU(input_shape=inp_tensor.shape, hidden_size=16)
  >>> out_tensor = rnn(inp_tensor)
  >>>
  torch.Size([4, 10, 5])
class_docstr_tok: ["This","function","implements","a","complex-valued","Light","GRU","(","liGRU",")",".","Ligru","is","single-gate","GRU","model","based","on","batch-norm","+","relu","activations","+","recurrent","dropout",".","For","more","info","see",":","''","M.","Ravanelli",",","P.","Brakel",",","M.","Omologo",",","Y.","Bengio",",","Light","Gated","Recurrent","Units","for","Speech","Recognition",",","in","IEEE","Transactions","on","Emerging","Topics","in","Computational","Intelligence",",","2018","''","(","https",":","\/\/arxiv.org\/abs\/1803.10225",")","To","speed","it","up",",","it","is","compiled","with","the","torch","just-in-time","compiler","(","jit",")","right","before","using","it",".","It","accepts","in","input","tensors","formatted","as","(","batch",",","time",",","fea",")",".","In","the","case","of","4d","inputs","like","(","batch",",","time",",","fea",",","channel",")","the","tensor","is","flattened","as","(","batch",",","time",",","fea","*","channel",")",".","Arguments","--","--","--","--","-","hidden_size",":","int","Number","of","output","neurons","(","i.e",",","the","dimensionality","of","the","output",")",".","Specified","value","is","in","term","of","complex-valued","neurons",".","Thus",",","the","output","is","2","*","hidden_size",".","nonlinearity",":","str","Type","of","nonlinearity","(","tanh",",","relu",")",".","normalization",":","str","Type","of","normalization","for","the","ligru","model","(","batchnorm",",","layernorm",")",".","Every","string","different","from","batchnorm","and","layernorm","will","result","in","no","normalization",".","num_layers",":","int","Number","of","layers","to","employ","in","the","RNN","architecture",".","bias",":","bool","If","True",",","the","additive","bias","b","is","adopted",".","dropout",":","float","It","is","the","dropout","factor","(","must","be","between","0","and","1",")",".","return_hidden",":","bool","If","True",",","the","function","returns","the","last","hidden","layer",".","bidirectional",":","bool","If","True",",","a","bidirectional","model","that","scans","the","sequence","both","right-to-left","and","left-to-right","is","used",".","init_criterion",":","str",",","optional","(","glorot",",","he",")",".","This","parameter","controls","the","initialization","criterion","of","the","weights",".","It","is","combined","with","weights_init","to","build","the","initialization","method","of","the","complex-valued","weights","(","default","``","glorot","''",")",".","weight_init",":","str",",","optional","(","complex",",","unitary",")",".","This","parameter","defines","the","initialization","procedure","of","the","complex-valued","weights","(","default","``","complex","''",")",".","``","complex","''","will","generate","random","complex-valued","weights","following","the","init_criterion","and","the","complex","polar","form",".","``","unitary","''","will","normalize","the","weights","to","lie","on","the","unit","circle",".","More","details","in",":","``","Deep","Complex","Networks","''",",","Trabelsi","C.","et","al",".","Example","--","--","--","-",">",">",">","inp_tensor","=","torch.rand","(","[","10",",","16",",","30","]",")",">",">",">","rnn","=","CLiGRU","(","input_shape=inp_tensor.shape",",","hidden_size=16",")",">",">",">","out_tensor","=","rnn","(","inp_tensor",")",">",">",">","torch.Size","(","[","4",",","10",",","5","]",")"]
docstr: Initializes the layers of the liGRU.
  
  Arguments
  ---------
  first_input : tensor
      A first input used for initializing the parameters.
docstr_tok: ["Initializes","the","layers","of","the","liGRU",".","Arguments","--","--","--","--","-","first_input",":","tensor","A","first","input","used","for","initializing","the","parameters","."]
code: def _init_layers(self):
      """Initializes the layers of the liGRU.
  
      Arguments
      ---------
      first_input : tensor
          A first input used for initializing the parameters.
      """
  
      rnn = torch.nn.ModuleList([])
      current_dim = self.fea_dim
  
      for i in range(self.num_layers):
          rnn_lay = CLiGRU_Layer(
              current_dim,
              self.hidden_size,
              self.num_layers,
              self.batch_size,
              dropout=self.dropout,
              nonlinearity=self.nonlinearity,
              normalization=self.normalization,
              bidirectional=self.bidirectional,
              init_criterion=self.init_criterion,
              weight_init=self.weight_init,
          )
          rnn.append(rnn_lay)
  
          if self.bidirectional:
              current_dim = self.hidden_size * 2
          else:
              current_dim = self.hidden_size
      return rnn
  
imports: import torch
  import logging
  from speechbrain.nnet.complex_networks.c_linear import CLinear
  from speechbrain.nnet.complex_networks.c_normalization import CBatchNorm, CLayerNorm
label_desc: Use image node_id 2 for calling the CLiGRU obj's underlying member method code with example usage: obj._init_layers() and returns: rnn