class_docstr: Sequence-to-sequence dynamic model.
  
  This class implements a multi-layer recurrent neural network as encoder,
  and a multi-layer recurrent neural network decoder.
class_docstr_tok: ["Sequence-to-sequence","dynamic","model",".","This","class","implements","a","multi-layer","recurrent","neural","network","as","encoder",",","and","a","multi-layer","recurrent","neural","network","decoder","."]
docstr: Create and call biddirectional RNN cells.
  
  Args:
    num_residual_layers: Number of residual layers from top to bottom. For
      example, if `num_bi_layers=4` and `num_residual_layers=2`, the last 2 RNN
      layers in each RNN cell will be wrapped with `ResidualWrapper`.
    base_gpu: The gpu device id to use for the first forward RNN layer. The
      i-th forward RNN layer will use `(base_gpu + i) % num_gpus` as its
      device id. The `base_gpu` for backward RNN cell is `(base_gpu +
      num_bi_layers)`.
  
  Returns:
    The concatenated bidirectional output and the bidirectional RNN cell"s
    state.
docstr_tok: ["Create","and","call","biddirectional","RNN","cells",".","Args",":","num_residual_layers",":","Number","of","residual","layers","from","top","to","bottom",".","For","example",",","if","`","num_bi_layers=4","`","and","`","num_residual_layers=2","`",",","the","last","2","RNN","layers","in","each","RNN","cell","will","be","wrapped","with","`","ResidualWrapper","`",".","base_gpu",":","The","gpu","device","id","to","use","for","the","first","forward","RNN","layer",".","The","i-th","forward","RNN","layer","will","use","`","(","base_gpu","+","i",")","%","num_gpus","`","as","its","device","id",".","The","`","base_gpu","`","for","backward","RNN","cell","is","`","(","base_gpu","+","num_bi_layers",")","`",".","Returns",":","The","concatenated","bidirectional","output","and","the","bidirectional","RNN","cell","''","s","state","."]
code: def _build_bidirectional_rnn(
      self,
      inputs,
      sequence_length,
      dtype,
      hparams,
      num_bi_layers,
      num_bi_residual_layers,
      base_gpu=0,
  ):
      """Create and call biddirectional RNN cells.
  
      Args:
        num_residual_layers: Number of residual layers from top to bottom. For
          example, if `num_bi_layers=4` and `num_residual_layers=2`, the last 2 RNN
          layers in each RNN cell will be wrapped with `ResidualWrapper`.
        base_gpu: The gpu device id to use for the first forward RNN layer. The
          i-th forward RNN layer will use `(base_gpu + i) % num_gpus` as its
          device id. The `base_gpu` for backward RNN cell is `(base_gpu +
          num_bi_layers)`.
  
      Returns:
        The concatenated bidirectional output and the bidirectional RNN cell"s
        state.
      """
      # Construct forward and backward cells
      fw_cell = self._build_encoder_cell(
          hparams,
          num_bi_layers,
          num_bi_residual_layers,
          base_gpu=base_gpu,
      )
      bw_cell = self._build_encoder_cell(
          hparams,
          num_bi_layers,
          num_bi_residual_layers,
          base_gpu=(base_gpu + num_bi_layers),
      )
  
      bi_outputs, bi_state = tf.nn.bidirectional_dynamic_rnn(
          fw_cell,
          bw_cell,
          inputs,
          dtype=dtype,
          sequence_length=sequence_length,
          time_major=self.time_major,
          swap_memory=True,
      )
  
      return tf.concat(bi_outputs, -1), bi_state
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import collections
  import tensorflow
  from tensorflow.contrib.model_pruning import get_masks, get_thresholds
  from tensorflow.contrib.model_pruning.python import pruning
  from tensorflow.contrib.model_pruning.python.layers import core_layers
  from .None import model_helper
  from .utils import misc_utils, iterator_utils
label_desc: Use image node_id 3 for calling the Model obj's underlying member method code with example usage: obj._build_bidirectional_rnn(inputs, sequence_length, dtype, hparams, num_bi_layers, num_bi_residual_layers, base_gpu) and returns: tf,  bi_state