class_docstr: Bidirectional forward-backward RNN encoder.
  
  Args:
      cell_fw (RNNCell, optional): The forward RNN cell. If not given,
          a cell is created as specified in :attr:`hparams["rnn_cell_fw"]`.
      cell_bw (RNNCell, optional): The backward RNN cell. If not given,
          a cell is created as specified in :attr:`hparams["rnn_cell_bw"]`.
      cell_dropout_mode (optional): A tensor taking value of
          :tf_main:`tf.estimator.ModeKeys <estimator/ModeKeys>`, which
          toggles dropout in the RNN cells (e.g., activates dropout in
          TRAIN mode). If `None`, :func:`~texar.tf.global_mode()` is
          used. Ignored if respective cell is given.
      output_layer_fw (optional): An instance of
          :tf_main:`tf.layers.Layer <layers/Layer>`. Apply to the forward
          RNN cell output of each step. If `None` (default), the output
          layer is created as specified in :attr:`hparams["output_layer_fw"]`.
      output_layer_bw (optional): An instance of
          :tf_main:`tf.layers.Layer <layers/Layer>`. Apply to the backward
          RNN cell output of each step. If `None` (default), the output
          layer is created as specified in :attr:`hparams["output_layer_bw"]`.
      hparams (dict or HParams, optional): Hyperparameters. Missing
          hyperparamerter will be set to default values. See
          :meth:`default_hparams` for the hyperparameter sturcture and
          default values.
  
  See :meth:`_build` for the inputs and outputs of the encoder.
  
  Example:
  
      .. code-block:: python
  
          # Use with embedder
          embedder = WordEmbedder(vocab_size, hparams=emb_hparams)
          encoder = BidirectionalRNNEncoder(hparams=enc_hparams)
  
          outputs, final_state = encoder(
              inputs=embedder(data_batch['text_ids']),
              sequence_length=data_batch['length'])
          # outputs == (outputs_fw, outputs_bw)
          # final_state == (final_state_fw, final_state_bw)
  
  .. document private functions
  .. automethod:: _build
class_docstr_tok: ["Bidirectional","forward-backward","RNN","encoder",".","Args",":","cell_fw","(","RNNCell",",","optional",")",":","The","forward","RNN","cell",".","If","not","given",",","a","cell","is","created","as","specified","in",":","attr",":","`","hparams","[","``","rnn_cell_fw","''","]","`",".","cell_bw","(","RNNCell",",","optional",")",":","The","backward","RNN","cell",".","If","not","given",",","a","cell","is","created","as","specified","in",":","attr",":","`","hparams","[","``","rnn_cell_bw","''","]","`",".","cell_dropout_mode","(","optional",")",":","A","tensor","taking","value","of",":","tf_main",":","`","tf.estimator.ModeKeys","<","estimator\/ModeKeys",">","`",",","which","toggles","dropout","in","the","RNN","cells","(","e.g.",",","activates","dropout","in","TRAIN","mode",")",".","If","`","None","`",",",":","func",":","`","~texar.tf.global_mode","(",")","`","is","used",".","Ignored","if","respective","cell","is","given",".","output_layer_fw","(","optional",")",":","An","instance","of",":","tf_main",":","`","tf.layers.Layer","<","layers\/Layer",">","`",".","Apply","to","the","forward","RNN","cell","output","of","each","step",".","If","`","None","`","(","default",")",",","the","output","layer","is","created","as","specified","in",":","attr",":","`","hparams","[","``","output_layer_fw","''","]","`",".","output_layer_bw","(","optional",")",":","An","instance","of",":","tf_main",":","`","tf.layers.Layer","<","layers\/Layer",">","`",".","Apply","to","the","backward","RNN","cell","output","of","each","step",".","If","`","None","`","(","default",")",",","the","output","layer","is","created","as","specified","in",":","attr",":","`","hparams","[","``","output_layer_bw","''","]","`",".","hparams","(","dict","or","HParams",",","optional",")",":","Hyperparameters",".","Missing","hyperparamerter","will","be","set","to","default","values",".","See",":","meth",":","`","default_hparams","`","for","the","hyperparameter","sturcture","and","default","values",".","See",":","meth",":","`","_build","`","for","the","inputs","and","outputs","of","the","encoder",".","Example",":","..","code-block",":",":","python","#","Use","with","embedder","embedder","=","WordEmbedder","(","vocab_size",",","hparams=emb_hparams",")","encoder","=","BidirectionalRNNEncoder","(","hparams=enc_hparams",")","outputs",",","final_state","=","encoder","(","inputs=embedder","(","data_batch","[","'text_ids","'","]",")",",","sequence_length=data_batch","[","'length","'","]",")","#","outputs","==","(","outputs_fw",",","outputs_bw",")","#","final_state","==","(","final_state_fw",",","final_state_bw",")","..","document","private","functions","..","automethod",":",":","_build"]
docstr: The state size of the backward encoder cell.
  
  Same as :attr:`encoder.cell_bw.state_size`.
docstr_tok: ["The","state","size","of","the","backward","encoder","cell",".","Same","as",":","attr",":","`","encoder.cell_bw.state_size","`","."]
code: def state_size_bw(self):
      """The state size of the backward encoder cell.
  
      Same as :attr:`encoder.cell_bw.state_size`.
      """
      return self.cell_bw.state_size
  
imports: import functools
  import numpy
  import tensorflow
  from tensorflow.contrib.framework import nest
  from texar.tf.modules.encoders.encoder_base import EncoderBase
  from texar.tf.modules.networks.conv_networks import _to_list
  from texar.tf.core import layers
  from texar.tf.utils.mode import is_train_mode
  from texar.tf.utils.shapes import mask_sequences
  from texar.tf.hyperparams import HParams
label_desc: Use image node_id 7 for calling the BidirectionalRNNEncoder obj's underlying member method code with example usage: obj.state_size_bw() and returns: self