class_docstr: The :class:`BiRNN` class is a fixed length Bidirectional recurrent layer.
  
  Parameters
  ----------
  fw_cell : TensorFlow cell function for forward direction
      A RNN cell implemented by tf.keras, e.g. tf.keras.layers.SimpleRNNCell, tf.keras.layers.LSTMCell, tf.keras.layers.GRUCell.
      Note TF2.0+, TF1.0+ and TF1.0- are different
  bw_cell: TensorFlow cell function for backward direction similar with `fw_cell`
  return_seq_2d : boolean.
      If True, return 2D Tensor [batch_size * n_steps, n_hidden], for stacking Dense layer after it.
      If False, return 3D Tensor [batch_size, n_steps, n_hidden], for stacking multiple RNN after it.
      In a dynamic model, `return_seq_2d` can be updated when it is called in customised forward().
      By default, `False`.
  return_last_state: boolean
      Whether to return the last state of the two cells. The state is a list of Tensor.
          - If True, the layer will return outputs, the final state of `fw_cell` and the final state of `bw_cell`.
          - If False, the layer will return outputs only.
  
      In a dynamic model, `return_last_state` can be updated when it is called in customised forward().
      By default, `False`.
  in_channels: int
      Optional, the number of channels of the previous layer which is normally the size of embedding.
      If given, the layer will be built when init.
      If None, it will be automatically detected when the layer is forwarded for the first time.
  name : str
      A unique layer name.
  
  Examples
  --------
  A simple regression model below.
  
  >>> inputs = tl.layers.Input([batch_size, num_steps, embedding_size])
  >>> # the fw_cell and bw_cell can be different
  >>> rnnlayer = tl.layers.BiRNN(
  >>>     fw_cell=tf.keras.layers.SimpleRNNCell(units=hidden_size, dropout=0.1),
  >>>     bw_cell=tf.keras.layers.SimpleRNNCell(units=hidden_size + 1, dropout=0.1),
  >>>     return_seq_2d=True, return_last_state=True
  >>> )
  >>> # if return_last_state=True, the final state of the two cells will be returned together with the outputs
  >>> # if return_last_state=False, only the outputs will be returned
  >>> rnn_out, rnn_fw_state, rnn_bw_state = rnnlayer(inputs)
  >>> # if the BiRNN is followed by a Dense, return_seq_2d should be True.
  >>> # if the BiRNN is followed by other RNN, return_seq_2d can be False.
  >>> dense = tl.layers.Dense(n_units=1)(rnn_out)
  >>> outputs = tl.layers.Reshape([-1, num_steps])(dense)
  >>> rnn_model = tl.models.Model(inputs=inputs, outputs=[outputs, rnn_out, rnn_fw_state[0], rnn_bw_state[0]])
  
  A stacked BiRNN model.
  
  >>> inputs = tl.layers.Input([batch_size, num_steps, embedding_size])
  >>> rnn_out1 = tl.layers.BiRNN(
  >>>     fw_cell=tf.keras.layers.SimpleRNNCell(units=hidden_size, dropout=0.1),
  >>>     bw_cell=tf.keras.layers.SimpleRNNCell(units=hidden_size + 1, dropout=0.1),
  >>>     return_seq_2d=False, return_last_state=False
  >>> )(inputs)
  >>> rnn_out2 = tl.layers.BiRNN(
  >>>     fw_cell=tf.keras.layers.SimpleRNNCell(units=hidden_size, dropout=0.1),
  >>>     bw_cell=tf.keras.layers.SimpleRNNCell(units=hidden_size + 1, dropout=0.1),
  >>>     return_seq_2d=True, return_last_state=False
  >>> )(rnn_out1)
  >>> dense = tl.layers.Dense(n_units=1)(rnn_out2)
  >>> outputs = tl.layers.Reshape([-1, num_steps])(dense)
  >>> rnn_model = tl.models.Model(inputs=inputs, outputs=outputs)
  
  Notes
  -----
  Input dimension should be rank 3 : [batch_size, n_steps, n_features]. If not, please see layer :class:`Reshape`.
class_docstr_tok: ["The",":","class",":","`","BiRNN","`","class","is","a","fixed","length","Bidirectional","recurrent","layer",".","Parameters","--","--","--","--","--","fw_cell",":","TensorFlow","cell","function","for","forward","direction","A","RNN","cell","implemented","by","tf.keras",",","e.g",".","tf.keras.layers.SimpleRNNCell",",","tf.keras.layers.LSTMCell",",","tf.keras.layers.GRUCell",".","Note","TF2.0+",",","TF1.0+","and","TF1.0-","are","different","bw_cell",":","TensorFlow","cell","function","for","backward","direction","similar","with","`","fw_cell","`","return_seq_2d",":","boolean",".","If","True",",","return","2D","Tensor","[","batch_size","*","n_steps",",","n_hidden","]",",","for","stacking","Dense","layer","after","it",".","If","False",",","return","3D","Tensor","[","batch_size",",","n_steps",",","n_hidden","]",",","for","stacking","multiple","RNN","after","it",".","In","a","dynamic","model",",","`","return_seq_2d","`","can","be","updated","when","it","is","called","in","customised","forward","(",")",".","By","default",",","`","False","`",".","return_last_state",":","boolean","Whether","to","return","the","last","state","of","the","two","cells",".","The","state","is","a","list","of","Tensor",".","-","If","True",",","the","layer","will","return","outputs",",","the","final","state","of","`","fw_cell","`","and","the","final","state","of","`","bw_cell","`",".","-","If","False",",","the","layer","will","return","outputs","only",".","In","a","dynamic","model",",","`","return_last_state","`","can","be","updated","when","it","is","called","in","customised","forward","(",")",".","By","default",",","`","False","`",".","in_channels",":","int","Optional",",","the","number","of","channels","of","the","previous","layer","which","is","normally","the","size","of","embedding",".","If","given",",","the","layer","will","be","built","when","init",".","If","None",",","it","will","be","automatically","detected","when","the","layer","is","forwarded","for","the","first","time",".","name",":","str","A","unique","layer","name",".","Examples","--","--","--","--","A","simple","regression","model","below",".",">",">",">","inputs","=","tl.layers.Input","(","[","batch_size",",","num_steps",",","embedding_size","]",")",">",">",">","#","the","fw_cell","and","bw_cell","can","be","different",">",">",">","rnnlayer","=","tl.layers.BiRNN","(",">",">",">","fw_cell=tf.keras.layers.SimpleRNNCell","(","units=hidden_size",",","dropout=0.1",")",",",">",">",">","bw_cell=tf.keras.layers.SimpleRNNCell","(","units=hidden_size","+","1",",","dropout=0.1",")",",",">",">",">","return_seq_2d=True",",","return_last_state=True",">",">",">",")",">",">",">","#","if","return_last_state=True",",","the","final","state","of","the","two","cells","will","be","returned","together","with","the","outputs",">",">",">","#","if","return_last_state=False",",","only","the","outputs","will","be","returned",">",">",">","rnn_out",",","rnn_fw_state",",","rnn_bw_state","=","rnnlayer","(","inputs",")",">",">",">","#","if","the","BiRNN","is","followed","by","a","Dense",",","return_seq_2d","should","be","True",".",">",">",">","#","if","the","BiRNN","is","followed","by","other","RNN",",","return_seq_2d","can","be","False",".",">",">",">","dense","=","tl.layers.Dense","(","n_units=1",")","(","rnn_out",")",">",">",">","outputs","=","tl.layers.Reshape","(","[","-1",",","num_steps","]",")","(","dense",")",">",">",">","rnn_model","=","tl.models.Model","(","inputs=inputs",",","outputs=","[","outputs",",","rnn_out",",","rnn_fw_state","[","0","]",",","rnn_bw_state","[","0","]","]",")","A","stacked","BiRNN","model",".",">",">",">","inputs","=","tl.layers.Input","(","[","batch_size",",","num_steps",",","embedding_size","]",")",">",">",">","rnn_out1","=","tl.layers.BiRNN","(",">",">",">","fw_cell=tf.keras.layers.SimpleRNNCell","(","units=hidden_size",",","dropout=0.1",")",",",">",">",">","bw_cell=tf.keras.layers.SimpleRNNCell","(","units=hidden_size","+","1",",","dropout=0.1",")",",",">",">",">","return_seq_2d=False",",","return_last_state=False",">",">",">",")","(","inputs",")",">",">",">","rnn_out2","=","tl.layers.BiRNN","(",">",">",">","fw_cell=tf.keras.layers.SimpleRNNCell","(","units=hidden_size",",","dropout=0.1",")",",",">",">",">","bw_cell=tf.keras.layers.SimpleRNNCell","(","units=hidden_size","+","1",",","dropout=0.1",")",",",">",">",">","return_seq_2d=True",",","return_last_state=False",">",">",">",")","(","rnn_out1",")",">",">",">","dense","=","tl.layers.Dense","(","n_units=1",")","(","rnn_out2",")",">",">",">","outputs","=","tl.layers.Reshape","(","[","-1",",","num_steps","]",")","(","dense",")",">",">",">","rnn_model","=","tl.models.Model","(","inputs=inputs",",","outputs=outputs",")","Notes","--","--","-","Input","dimension","should","be","rank","3",":","[","batch_size",",","n_steps",",","n_features","]",".","If","not",",","please","see","layer",":","class",":","`","Reshape","`","."]
code: def __repr__(self):
      s = (
          "{classname}(fw_cell={fw_cellname}, fw_n_units={fw_n_units}"
          ", bw_cell={bw_cellname}, bw_n_units={bw_n_units}"
      )
      s += ", name='{name}'"
      s += ")"
      return s.format(
          classname=self.__class__.__name__,
          fw_cellname=self.fw_cell.__class__.__name__,
          fw_n_units=self.fw_cell.units,
          bw_cellname=self.bw_cell.__class__.__name__,
          bw_n_units=self.bw_cell.units,
          **self.__dict__,
      )
  
imports: import numpy
  import tensorflow
  import tensorlayer
  from tensorlayer import logging
  from tensorlayer.decorators import deprecated_alias
  from tensorlayer.layers.core import Layer
label_desc: Use image node_id 2 for calling the BiRNN obj's underlying member method code with example usage: obj.__repr__() and returns: s