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