code: def backward(
      self, grad_output, grad_hy
  ):  # pylint: disable=arguments-differ
      (
          inputs,
          lengths,
          weight,
          bias,
          state_accumulator,  # pylint: disable=unpacking-non-sequence
          memory_accumulator,
          dropout_mask,
          gates,
      ) = self.saved_tensors
  
      inputs = inputs.contiguous()
      sequence_length, batch_size, input_size = inputs.size()
      parameters_need_grad = (
          1 if self.needs_input_grad[1] else 0
      )  # pylint: disable=unsubscriptable-object
  
      grad_input = torch.zeros_like(inputs)
      grad_state_accumulator = inputs.new_zeros(
          *state_accumulator.size()
      )
      grad_memory_accumulator = inputs.new_zeros(
          *memory_accumulator.size()
      )
      grad_weight = inputs.new_empty(0)
      grad_bias = inputs.new_empty(0)
      grad_dropout = None
      grad_lengths = None
      grad_gates = None
  
      if parameters_need_grad:
          grad_weight.resize_as_(weight).zero_()
          grad_bias.resize_as_(bias).zero_()
  
      tmp_i_gates_grad = inputs.new_zeros(
          batch_size, 6 * self.hidden_size
      )
      tmp_h_gates_grad = inputs.new_zeros(
          batch_size, 5 * self.hidden_size
      )
  
      is_training = 1 if self.train else 0
      highway_lstm_layer.highway_lstm_backward_cuda(
          input_size,  # pylint: disable=no-member
          self.hidden_size,
          batch_size,
          self.num_layers,
          sequence_length,
          grad_output,
          lengths,
          grad_state_accumulator,
          grad_memory_accumulator,
          inputs,
          state_accumulator,
          memory_accumulator,
          weight,
          gates,
          dropout_mask,
          tmp_h_gates_grad,
          tmp_i_gates_grad,
          grad_hy,
          grad_input,
          grad_weight,
          grad_bias,
          is_training,
          parameters_need_grad,
      )
  
      return (
          grad_input,
          grad_weight,
          grad_bias,
          grad_state_accumulator,
          grad_memory_accumulator,
          grad_dropout,
          grad_lengths,
          grad_gates,
      )
  
file_path: magnitude/pymagnitude/third_party/allennlp/modules/alternating_highway_lstm.py
imports: from __future__ import absolute_import
  import torch
  from torch.autograd import Function
  from torch.nn import Parameter
  from torch.nn.utils.rnn import PackedSequence, pad_packed_sequence, pack_padded_sequence
  from allennlp.nn.initializers import block_orthogonal
  from allennlp.custom_extensions._ext import highway_lstm_layer
label_desc: Use image node_id 3 for calling the _AlternatingHighwayLSTMFunction obj's underlying member method code with example usage: obj.backward(grad_output, grad_hy) and returns: grad_input,  grad_weight,  grad_bias,  grad_state_accumulator,  grad_memory_accumulator,  grad_dropout,  grad_lengths,  grad_gates