code: def forward(self, inputs):
      xp = backend.get_array_module(*inputs)
      c_prev, x, c_next, gc, gh = inputs
      batch = len(x)
  
      gx = xp.empty_like(x)
      ga, gi, gf, go = _extract_gates(gx)
  
      # Consider the case that either gradient is not given
      if gc is None:
          gc_update = 0
          gc_rest = 0
      else:
          gc_update = gc[:batch]
          gc_rest = gc[batch:]
      if gh is None:
          gh = 0
  
      a, i, f, o = _extract_gates(x)
      if xp is numpy:
          if intel64.should_use_ideep(">=auto"):
              xp = intel64.ideep.get_array_module(x)
          tanh_a = xp.tanh(a)
          sig_i = _sigmoid(i, xp)
          sig_f = _sigmoid(f, xp)
          sig_o = _sigmoid(o, xp)
  
          co = xp.tanh(c_next[:batch])
          gc_prev = numpy.empty_like(c_prev)
          # multiply f later
          gc_prev[:batch] = gh * sig_o * _grad_tanh(co) + gc_update
          gc = gc_prev[:batch]
          ga[:] = gc * sig_i * _grad_tanh(tanh_a)
          gi[:] = gc * tanh_a * _grad_sigmoid(sig_i)
          gf[:] = gc * c_prev[:batch] * _grad_sigmoid(sig_f)
          go[:] = gh * co * _grad_sigmoid(sig_o)
          gc_prev[:batch] *= sig_f  # multiply f here
          gc_prev[batch:] = gc_rest
      else:
          gc_prev = xp.empty_like(c_prev)
          cuda.elementwise(
              "T c_prev, T c, T gc, T gh, T a, T i_, T f, T o",
              "T gc_prev, T ga, T gi, T gf, T go",
              """
                      COMMON_ROUTINE;
                      T co = tanh(c);
                      T temp = gh * ao * grad_tanh(co) + gc;
                      ga = temp * ai * grad_tanh(aa);
                      gi = temp * aa * grad_sigmoid(ai);
                      gf = temp * c_prev * grad_sigmoid(af);
                      go = gh * co * grad_sigmoid(ao);
                      gc_prev = temp * af;
                  """,
              "lstm_bwd",
              preamble=_preamble,
          )(
              c_prev[:batch],
              c_next[:batch],
              gc_update,
              gh,
              a,
              i,
              f,
              o,
              gc_prev[:batch],
              ga,
              gi,
              gf,
              go,
          )
          gc_prev[batch:] = gc_rest
  
      return gc_prev, gx
  
imports: import numpy
  import six
  import chainer
  from chainer import backend
  from chainer.backends import cuda
  from chainer.backends import intel64
  from chainer import function
  from chainer import function_node
  from chainer.utils import type_check
  import chainerx
label_desc: Use image node_id 1 for calling the LSTMGrad obj's underlying member method code with example usage: obj.forward(inputs) and returns: gc_prev,  gx