docs: def _build(self, input_sequence, state):
      """Connects the BidirectionalRNN module into the graph.
  
      Args:
        input_sequence: tensor (time, batch, [feature_1, ..]). It must be
            time_major.
        state: tuple of states for the forward and backward cores.
  
      Returns:
        A dict with forward/backard states and output sequences:
  
          "outputs":{
              "forward": ...,
              "backward": ...},
          "state": {
              "forward": ...,
              "backward": ...}
  
      Raises:
        ValueError: in case time dimension is not statically known.
      """
      input_shape = input_sequence.get_shape()
      if input_shape[0] is None:
        raise ValueError("Time dimension of input (dim 0) must be statically"
                         "known.")
      seq_length = int(input_shape[0])
      forward_state, backward_state = state
  
      # Lists for the forward backward output and state.
      output_sequence_f = []
      output_sequence_b = []
  
      # Forward pass over the sequence.
      with tf.name_scope("forward_rnn"):
        core_state = forward_state
        for i in six.moves.range(seq_length):
          core_output, core_state = self._forward_core(
              input_sequence[i, :,], core_state)
  
          output_sequence_f.append((core_output, core_state))
  
        output_sequence_f = nest.map_structure(
            lambda *vals: tf.stack(vals), *output_sequence_f)
  
      # Backward pass over the sequence.
      with tf.name_scope("backward_rnn"):
        core_state = backward_state
        for i in six.moves.range(seq_length - 1, -1, -1):
          core_output, core_state = self._backward_core(
              input_sequence[i, :,], core_state)
  
          output_sequence_b.append((core_output, core_state))
  
        output_sequence_b = nest.map_structure(
            lambda *vals: tf.stack(vals), *output_sequence_b)
  
      # Compose the full output and state sequeneces.
      return {
          "outputs": {
              "forward": output_sequence_f[0],
              "backward": output_sequence_b[0]
          },
          "state": {
              "forward": output_sequence_f[1],
              "backward": output_sequence_b[1]
          }
      }