class_docstr: Processes the input in both directions and merges the results.
  
  Example usage::
  
    >>> import flax.linen as nn
    >>> import jax, jax.numpy as jnp
  
    >>> layer = nn.Bidirectional(nn.RNN(nn.GRUCell(4)), nn.RNN(nn.GRUCell(4)))
    >>> x = jnp.ones((2, 3))
    >>> variables = layer.init(jax.random.key(0), x)
    >>> out = layer.apply(variables, x)
code: def __call__(
      self,
      inputs: jax.Array,
      *,
      initial_carry: Optional[Carry] = None,
      init_key: Optional[PRNGKey] = None,
      seq_lengths: Optional[Array] = None,
      return_carry: Optional[bool] = None,
      time_major: Optional[bool] = None,
      reverse: Optional[bool] = None,
      keep_order: Optional[bool] = None,
  ) -> Union[Output, Tuple[Carry, Output]]:
      if time_major is None:
          time_major = self.time_major
      if return_carry is None:
          return_carry = self.return_carry
      if init_key is not None:
          key_forward, key_backward = random.split(init_key)
      else:
          key_forward = key_backward = None
      if initial_carry is not None:
          initial_carry_forward, initial_carry_backward = initial_carry
      else:
          initial_carry_forward = initial_carry_backward = None
      # Throw a warning in case the user accidentally re-uses the forward RNN
      # for the backward pass and does not intend for them to share parameters.
      if self.forward_rnn is self.backward_rnn:
          logging.warning(
              (
                  "forward_rnn and backward_rnn is the same object, so "
                  "they will share parameters."
              )
          )
  
      # Encode in the forward direction.
      carry_forward, outputs_forward = self.forward_rnn(
          inputs,
          initial_carry=initial_carry_forward,
          init_key=key_forward,
          seq_lengths=seq_lengths,
          return_carry=True,
          time_major=time_major,
          reverse=False,
      )
  
      carry_backward, outputs_backward = self.backward_rnn(
          inputs,
          initial_carry=initial_carry_backward,
          init_key=key_backward,
          seq_lengths=seq_lengths,
          return_carry=True,
          time_major=time_major,
          reverse=True,
          keep_order=True,
      )
  
      carry = (carry_forward, carry_backward)
      outputs = jax.tree_map(
          self.merge_fn, outputs_forward, outputs_backward
      )
  
      if return_carry:
          return carry, outputs
      else:
          return outputs
  
imports: from functools import partial
  from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Tuple, TypeVar, Union
  import jax
  import numpy
  from absl import logging
  from jax import numpy
  from jax import random
  from typing_extensions import Protocol
  from flax.core import lift
  from flax.core.frozen_dict import FrozenDict
  from flax.linen import initializers, transforms
  from flax.linen.activation import sigmoid, tanh
  from flax.linen.dtypes import promote_dtype
  from flax.linen.linear import Conv, Dense, PrecisionLike, default_kernel_init
  from flax.linen.module import Module, compact, nowrap
label_desc: Use image node_id 1 for calling the Bidirectional obj's underlying member method code with example usage: obj.__call__(inputs) and returns: carry,  outputs, outputs