code: def n_step_rnn(
      n_layers,
      dropout_ratio,
      hx,
      ws,
      bs,
      xs,
      activation="tanh",
      **kwargs,
  ):
      """n_step_rnn(n_layers, dropout_ratio, hx, ws, bs, xs, activation='tanh')
  
      Stacked Uni-directional RNN function for sequence inputs.
  
      This function calculates stacked Uni-directional RNN with sequences.
      This function gets an initial hidden state :math:`h_0`,
      an initial cell state :math:`c_0`, an input sequence :math:`x`,
      weight matrices :math:`W`, and bias vectors :math:`b`.
      This function calculates hidden states :math:`h_t` and :math:`c_t` for each
      time :math:`t` from input :math:`x_t`.
  
      .. math::
         h_t = f(W_0 x_t + W_1 h_{t-1} + b_0 + b_1)
  
      where :math:`f` is an activation function.
  
      Weight matrices :math:`W` contains two matrices :math:`W_0` and
      :math:`W_1`. :math:`W_0` is a parameter for an input sequence.
      :math:`W_1` is a parameter for a hidden state.
      Bias matrices :math:`b` contains two matrices :math:`b_0` and :math:`b_1`.
      :math:`b_0` is a parameter for an input sequence.
      :math:`b_1` is a parameter for a hidden state.
  
  
      As the function accepts a sequence, it calculates :math:`h_t` for all
      :math:`t` with one call. Two weight matrices and two bias vectors are
      required for each layer. So, when :math:`S` layers exist, you need to
      prepare :math:`2S` weight matrices and :math:`2S` bias vectors.
  
      If the number of layers ``n_layers`` is greather than :math:`1`, input
      of ``k``-th layer is hidden state ``h_t`` of ``k-1``-th layer.
      Note that all input variables except first layer may have different shape
      from the first layer.
  
      Args:
          n_layers(int): Number of layers.
          dropout_ratio(float): Dropout ratio.
          hx (:class:`~chainer.Variable`):
              Variable holding stacked hidden states.
              Its shape is ``(S, B, N)`` where ``S`` is number of layers and is
              equal to ``n_layers``, ``B`` is mini-batch size, and ``N`` is
              dimension of hidden units.
          ws (list of list of :class:`~chainer.Variable`): Weight matrices.
              ``ws[i]`` represents weights for i-th layer.
              Each ``ws[i]`` is a list containing two matrices.
              ``ws[i][j]`` is corresponding with ``W_j`` in the equation.
              Only ``ws[0][j]`` where ``0 <= j < 1`` is ``(N, I)`` shape as they
              are multiplied with input variables. All other matrices has
              ``(N, N)`` shape.
          bs (list of list of :class:`~chainer.Variable`): Bias vectors.
              ``bs[i]`` represnents biases for i-th layer.
              Each ``bs[i]`` is a list containing two vectors.
              ``bs[i][j]`` is corresponding with ``b_j`` in the equation.
              Shape of each matrix is ``(N,)`` where ``N`` is dimension of
              hidden units.
          xs (list of :class:`~chainer.Variable`):
              A list of :class:`~chainer.Variable` holding input values.
              Each element ``xs[t]`` holds input value for time ``t``.
              Its shape is ``(B_t, I)``, where ``B_t`` is
              mini-batch size for time ``t``, and ``I`` is size of input units.
              Note that this function supports variable length sequences.
              When sequneces has different lengths, sort sequences in descending
              order by length, and transpose the sorted sequence.
              :func:`~chainer.functions.transpose_sequence` transpose a list
              of :func:`~chainer.Variable` holding sequence.
              So ``xs`` needs to satisfy
              ``xs[t].shape[0] >= xs[t + 1].shape[0]``.
          activation (str): Activation function name.
              Please select ``tanh`` or ``relu``.
  
      Returns:
          tuple: This function returns a tuple containing two elements,
          ``hy`` and ``ys``.
  
          - ``hy`` is an updated hidden states whose shape is same as ``hx``.
          - ``ys`` is a list of :class:`~chainer.Variable` . Each element
            ``ys[t]`` holds hidden states of the last layer corresponding
            to an input ``xs[t]``. Its shape is ``(B_t, N)`` where ``B_t`` is
            mini-batch size for time ``t``, and ``N`` is size of hidden
            units. Note that ``B_t`` is the same value as ``xs[t]``.
  
      """
      return n_step_rnn_base(
          n_layers,
          dropout_ratio,
          hx,
          ws,
          bs,
          xs,
          activation,
          use_bi_direction=False,
          **kwargs,
      )
  
imports: import itertools
  import numpy
  import six
  import chainer
  import chainerx
  from chainer import backend
  from chainer import variable
  from chainer.backends import cuda
  from chainer import configuration
  from chainer import function
  from chainer.functions.activation import relu
  from chainer.functions.activation import tanh
  from chainer.functions.array import concat
  from chainer.functions.array import split_axis
  from chainer.functions.array import stack
  from chainer.functions.connection import linear
  from chainer.functions.noise import dropout
  from chainer.utils import argument
  from chainer.utils import type_check
label_desc: Use image node_id 5 for calling a global function with example usage: n_step_rnn(n_layers, dropout_ratio, hx, ws, bs, xs, activation) and returns: n_step_rnn_base