code: def _run(  # type: ignore
      self,
      X,
      W,
      R,
      B=None,
      sequence_lens=None,
      initial_h=None,
      activation_alpha=None,
      activation_beta=None,
      activations=None,
      clip=None,
      direction=None,
      hidden_size=None,
      layout=None,
  ):
      # TODO: support overridden attributes.
      self.num_directions = W.shape[0]
  
      if self.num_directions == 1:
          R = np.squeeze(R, axis=0)
          W = np.squeeze(W, axis=0)
          if B is not None:
              B = np.squeeze(B, axis=0)
          if sequence_lens is not None:
              sequence_lens = np.squeeze(sequence_lens, axis=0)
          if initial_h is not None:
              initial_h = np.squeeze(initial_h, axis=0)
  
          hidden_size = R.shape[-1]
          batch_size = X.shape[1]
  
          X = X if layout == 0 else np.swapaxes(X, 0, 1)
          b = (
              B
              if B is not None
              else np.zeros(2 * hidden_size, dtype=X.dtype)
          )
          h_0 = (
              initial_h
              if initial_h is not None
              else np.zeros((batch_size, hidden_size), dtype=X.dtype)
          )
  
          B = b
          H_0 = h_0
      else:
          raise NotImplementedError(
              f"Unsupported value {self.num_directions} for num_directions and operator {self.__class__.__name__!r}."
          )
  
      Y, Y_h = self._step(X, R, B, W, H_0)
      if layout == 1:
          Y = np.transpose(Y, [2, 0, 1, 3])
          Y_h = Y[:, :, -1, :]
  
      Y = Y.astype(X.dtype)
      return (Y,) if self.n_outputs == 1 else (Y, Y_h)
  
file_path: onnx/onnx/reference/ops/op_rnn.py
imports: import numpy
  from onnx.reference.op_run import OpRun
label_desc: Use image node_id 5 for calling the CommonRNN obj's underlying member method code with example usage: obj._run(X, W, R, B, sequence_lens, initial_h, activation_alpha, activation_beta, activations, clip, direction, hidden_size, layout) and returns: unknown