class_docstr: Implementation of recurrent layers.
class_docstr_tok: ["Implementation","of","recurrent","layers","."]
docstr: forward using CUDNN or CPU kenrel
docstr_tok: ["forward","using","CUDNN","or","CPU","kenrel"]
code: def _forward_kernel(self, inputs, states, sequence_length):
      """forward using CUDNN or CPU kenrel"""
      device = inputs.device
      if self._layout == "NTC":
          inputs = np.swapaxes(inputs, 0, 1)
  
      if self._use_sequence_length:
          rnn_args = states + [sequence_length]
      else:
          rnn_args = states
  
      rnn_args_device = []
      for args in rnn_args:
          new_args = args.to_device(device)
          rnn_args_device.append(new_args)
  
      rnn = npx.rnn(
          inputs,
          self.rnn_param.data(device),
          *rnn_args_device,
          use_sequence_length=self._use_sequence_length,
          state_size=self._hidden_size,
          projection_size=self._projection_size,
          num_layers=self._num_layers,
          bidirectional=self._dir == 2,
          p=self._dropout,
          state_outputs=True,
          mode=self._mode,
          lstm_state_clip_min=self._lstm_state_clip_min,
          lstm_state_clip_max=self._lstm_state_clip_max,
          lstm_state_clip_nan=self._lstm_state_clip_nan,
      )
  
      if self._mode == "lstm":
          outputs, states = rnn[0], [rnn[1], rnn[2]]
      else:
          outputs, states = rnn[0], [rnn[1]]
  
      if self._layout == "NTC":
          outputs = np.swapaxes(outputs, 0, 1)
  
      return outputs, states
  
imports: from ...None import np, npx, initializer, cpu
  from ..None import HybridBlock, tensor_types
  from ..parameter import Parameter
  from ...util import use_np
label_desc: Use image node_id 9 for calling the _RNNLayer obj's underlying member method code with example usage: obj._forward_kernel(inputs, states, sequence_length) and returns: outputs,  states