code: def __init__(self, **params: Any) -> None:
      # LSTM Input Names
      X = "X"
      W = "W"
      R = "R"
      B = "B"
      H_0 = "initial_h"
      C_0 = "initial_c"
      P = "P"
      LAYOUT = "layout"
      number_of_gates = 4
      number_of_peepholes = 3
  
      required_inputs = [X, W, R]
      for i in required_inputs:
          assert i in params, f"Missing Required Input: {i}"
  
      self.num_directions = params[W].shape[0]
  
      if self.num_directions == 1:
          for k in params:
              if k != X:
                  params[k] = np.squeeze(params[k], axis=0)
  
          hidden_size = params[R].shape[-1]
          batch_size = params[X].shape[1]
  
          layout = params[LAYOUT] if LAYOUT in params else 0
          x = params[X]
          x = x if layout == 0 else np.swapaxes(x, 0, 1)
          b = (
              params[B]
              if B in params
              else np.zeros(
                  2 * number_of_gates * hidden_size, dtype=np.float32
              )
          )
          p = (
              params[P]
              if P in params
              else np.zeros(
                  number_of_peepholes * hidden_size, dtype=np.float32
              )
          )
          h_0 = (
              params[H_0]
              if H_0 in params
              else np.zeros((batch_size, hidden_size), dtype=np.float32)
          )
          c_0 = (
              params[C_0]
              if C_0 in params
              else np.zeros((batch_size, hidden_size), dtype=np.float32)
          )
  
          self.X = x
          self.W = params[W]
          self.R = params[R]
          self.B = b
          self.P = p
          self.H_0 = h_0
          self.C_0 = c_0
          self.LAYOUT = layout
  
      else:
          raise NotImplementedError()
  
file_path: onnx/onnx/backend/test/case/node/lstm.py
imports: from typing import Any, Tuple
  import numpy
  import onnx
  from onnx.backend.test.case.base import Base
  from onnx.backend.test.case.node import expect
label_desc: Use image node_id 1 to create a new LSTMHelper object  with example: obj = LSTMHelper()