code: def split_rnn_params(
      param,
      mode,
      num_layers,
      input_size,
      hidden_size,
      bidirectional=False,
      projection_size=None,
  ):
      """Split rnn layer parameter into weight and bias in different layer.
  
      Parameters
      ----------
      param : ndarray
          The parameter of rnn layer.
      mode : str
          Mode of rnn. Supported modes: rnn_relu, rnn_tanh, lstm, gru
      num_layers : int, default 1
          Number of recurrent layers.
      input_size: int, default 0
          The number of expected features in the input x.
          If not specified, it will be inferred from input.
      hidden_size: int
          The number of features in the hidden state h.
      bidirectional: bool, default False
          If `True`, becomes a bidirectional RNN.
      projection_size: int, default None
          The number of features after projection.
      """
      gates = {"rnn_relu": 1, "rnn_tanh": 1, "lstm": 4, "gru": 3}[mode]
      dir = 2 if bidirectional else 1
      param_dict = {}
      begin = 0
      if not projection_size:
          for p in ["weight", "bias"]:
              for l in range(num_layers):
                  for d in ["l", "r"][:dir]:
                      for g in ["i2h", "h2h"]:
                          ni = input_size
                          if l != 0:
                              ni = hidden_size * dir
                          if g == "h2h":
                              ni = hidden_size
                          shape0 = gates * hidden_size
                          if p == "weight":
                              cur_len = shape0 * ni
                              param_dict[
                                  "{}{}_{}_{}".format(d, l, g, p)
                              ] = param[
                                  begin : begin + cur_len
                              ].reshape(
                                  shape0, ni
                              )
                          else:
                              cur_len = shape0
                              param_dict[
                                  "{}{}_{}_{}".format(d, l, g, p)
                              ] = param[
                                  begin : begin + cur_len
                              ].reshape(
                                  shape0,
                              )
                          begin += cur_len
      else:
          for p in ["weight", "bias"]:
              for l in range(num_layers):
                  for d in ["l", "r"][:dir]:
                      for g in ["i2h", "h2h", "h2r"]:
                          if g != "h2r" or p != "bias":
                              if g == "h2r":
                                  cur_len = (
                                      projection_size * hidden_size
                                  )
                                  param_dict[
                                      "{}{}_{}_{}".format(d, l, g, p)
                                  ] = param[
                                      begin : begin + cur_len
                                  ].reshape(
                                      projection_size, hidden_size
                                  )
                              else:
                                  ni = input_size
                                  if l != 0:
                                      ni = projection_size * dir
                                  if g == "h2h":
                                      ni = projection_size
                                  shape0 = gates * hidden_size
                                  if p == "weight":
                                      cur_len = shape0 * ni
                                      param_dict[
                                          "{}{}_{}_{}".format(
                                              d, l, g, p
                                          )
                                      ] = param[
                                          begin : begin + cur_len
                                      ].reshape(
                                          shape0, ni
                                      )
                                  else:
                                      cur_len = shape0
                                      param_dict[
                                          "{}{}_{}_{}".format(
                                              d, l, g, p
                                          )
                                      ] = param[
                                          begin : begin + cur_len
                                      ].reshape(
                                          shape0,
                                      )
                              begin += cur_len
      return param_dict
  
imports: import os
  import sys
  import hashlib
  import uuid
  import warnings
  import collections
  import weakref
  import requests
  import numpy
  from ..None import ndarray
  from ..util import is_np_shape, is_np_array, TemporaryDirectory
  from ..None import numpy
label_desc: Use image node_id 14 for calling a global function with example usage: split_rnn_params(param, mode, num_layers, input_size, hidden_size, bidirectional, projection_size) and returns: param_dict