class_docstr: Implementation of recurrent layers.
class_docstr_tok: ["Implementation","of","recurrent","layers","."]
code: def infer_shape(self, inputs, *args):
      assert (
          inputs.ndim == 3
      ), "Input data should be rank-3 tensor of dim [sequence length, batch size, input size]"
      self._input_size = inputs.shape[2]
      ng, ni, nh = self._gates, inputs.shape[2], self._hidden_size
  
      size = nh * self._dir * ng
      size1 = (ni + nh + 2) * size  # first layer size
      size2 = (nh * self._dir + nh + 2) * size  # second layer size
      if self._projection_size:
          size1 = (
              ni + self._projection_size + 2
          ) * size  # first layer size
          size2 = (
              self._projection_size * self._dir
              + self._projection_size
              + 2
          ) * size  # second layer size
      param_size = size1 + (self._num_layers - 1) * size2
      if self._projection_size:
          param_size += (
              self._projection_size * nh * self._num_layers * self._dir
          )
      self.rnn_param.shape = (param_size,)
  
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 8 for calling the _RNNLayer obj's underlying member method code with example usage: obj.infer_shape(inputs) without return types