docstr: Forward for just one step
  
  Parameters
  ----------
  step_data
      Shape (B,)
  mem_l
      A list of memory objects
  
      - layout = 'NT'
          Shape (B, T_mem, units)
      - layout = 'TN'
          Shape (T_mem, B, units)
  
  Returns
  -------
  logits
      Shape (B, V)
  new_mem_l
      A list of memory objects
  
      - layout = 'NT'
          Shape (B, min(T_mem + 1, memory_length), C)
      - layout = 'TN'
          Shape (min(T_mem + 1, memory_length), B, C)
docstr_tok: ["Forward","for","just","one","step","Parameters","--","--","--","--","--","step_data","Shape","(","B",",",")","mem_l","A","list","of","memory","objects","-","layout","=","'NT'","Shape","(","B",",","T_mem",",","units",")","-","layout","=","'TN'","Shape","(","T_mem",",","B",",","units",")","Returns","--","--","--","-","logits","Shape","(","B",",","V",")","new_mem_l","A","list","of","memory","objects","-","layout","=","'NT'","Shape","(","B",",","min","(","T_mem","+","1",",","memory_length",")",",","C",")","-","layout","=","'TN'","Shape","(","min","(","T_mem","+","1",",","memory_length",")",",","B",",","C",")"]
code: def step_forward(self, step_data, mem_l):
      """Forward for just one step
  
      Parameters
      ----------
      step_data
          Shape (B,)
      mem_l
          A list of memory objects
  
          - layout = 'NT'
              Shape (B, T_mem, units)
          - layout = 'TN'
              Shape (T_mem, B, units)
  
      Returns
      -------
      logits
          Shape (B, V)
      new_mem_l
          A list of memory objects
  
          - layout = 'NT'
              Shape (B, min(T_mem + 1, memory_length), C)
          - layout = 'TN'
              Shape (min(T_mem + 1, memory_length), B, C)
  
      """
      batch_size = step_data.shape[0]
      if self._layout == "NT":
          curr_mem_length = mem_l[0].shape[1]
      elif self._layout == "TN":
          curr_mem_length = mem_l[0].shape[0]
      else:
          raise NotImplementedError
      ctx = step_data.ctx
      mask = mx.np.ones(
          (batch_size, 1, curr_mem_length + 1), dtype=np.int32, ctx=ctx
      )
      rel_positions = mx.np.expand_dims(
          mx.np.arange(
              curr_mem_length, -1, -1, dtype=np.int32, ctx=ctx
          ),
          axis=0,
      )
      # Word embedding shape = (B, C)
      word_embeddings = self.dropout_layer(self.word_emb(step_data))
      if self._layout == "NT":
          word_embeddings = mx.np.expand_dims(word_embeddings, axis=1)
      elif self._layout == "TN":
          word_embeddings = mx.np.expand_dims(word_embeddings, axis=0)
      else:
          raise NotImplementedError
      out_l = self.decoder(word_embeddings, mem_l, rel_positions, mask)
  
      # Get logits
      if self._layout == "NT":
          final_out = out_l[-1][:, 0]
      elif self._layout == "TN":
          final_out = out_l[-1][0, :]
      else:
          raise NotImplementedError
      logits = self.crit.get_logits(final_out)
  
      # Update memory
      new_mem_l = []
      for step_out, mem in zip([word_embeddings] + out_l, mem_l):
          if self._layout == "NT":
              new_mem = mx.np.concatenate([mem, step_out], axis=1)
              new_mem = new_mem[:, -self.mem_length :]
          elif self._layout == "TN":
              new_mem = mx.np.concatenate([mem, step_out], axis=0)
              new_mem = new_mem[-self.mem_length :, :]
          else:
              raise NotImplementedError
          new_mem_l.append(new_mem)
      return logits, new_mem_l
  
imports: import numpy
  import mxnet
  from mxnet import use_np, np, npx
  from mxnet.gluon import nn, Block, HybridBlock, Parameter
  from ..attention_cell import multi_head_dot_attn, gen_self_attn_mask, gen_mem_attn_mask, RelAttentionScoreCell, MultiHeadAttentionCell
  from ..layers import get_activation, PositionalEmbedding, PositionwiseFFN, AdaptiveEmbedding, ProjectedAdaptiveLogSoftmaxWithLoss
  from ..utils.config import CfgNode
  from ..sequence_sampler import BaseStepDecoder
label_desc: Use image node_id 10 for calling the TransformerXLForLM obj's underlying member method code with example usage: obj.step_forward(step_data, mem_l) and returns: logits,  new_mem_l