code: def _test_lstm(self, gpu):
      in_size = 2
      out_size = 3
      seqs_x = [
          np.random.uniform(-1, 1, size=(4, in_size)).astype(
              np.float32
          ),
          np.random.uniform(-1, 1, size=(1, in_size)).astype(
              np.float32
          ),
          np.random.uniform(-1, 1, size=(3, in_size)).astype(
              np.float32
          ),
      ]
      link = L.NStepLSTM(1, in_size, out_size, 0)
  
      # Forward twice: with None and non-None random states
      h0, c0, y0 = link(None, None, seqs_x)
      h1, c1, y1 = link(h0, c0, seqs_x)
      self.assertEqual(h0.shape, (1, 3, out_size))
      self.assertEqual(c0.shape, (1, 3, out_size))
      self.assertEqual(h1.shape, (1, 3, out_size))
      self.assertEqual(c1.shape, (1, 3, out_size))
  
      # Masked at 0
      rs0_mask0 = stateless_recurrent.mask_recurrent_state_at(
          link, (h0, c0), 0
      )
      _, _, y1m0 = link(rs0_mask0[0], rs0_mask0[1], seqs_x)
      np.testing.assert_allclose(y1m0[0].array, y0[0].array)
      np.testing.assert_allclose(y1m0[1].array, y1[1].array)
      np.testing.assert_allclose(y1m0[2].array, y1[2].array)
  
      # Masked at 1
      rs0_mask1 = stateless_recurrent.mask_recurrent_state_at(
          link, (h0, c0), 1
      )
      _, _, y1m1 = link(rs0_mask1[0], rs0_mask1[1], seqs_x)
      np.testing.assert_allclose(y1m1[0].array, y1[0].array)
      np.testing.assert_allclose(y1m1[1].array, y0[1].array)
      np.testing.assert_allclose(y1m1[2].array, y1[2].array)
  
      # Masked at (1, 2)
      rs0_mask12 = stateless_recurrent.mask_recurrent_state_at(
          link, (h0, c0), (1, 2)
      )
      _, _, y1m12 = link(rs0_mask12[0], rs0_mask12[1], seqs_x)
      np.testing.assert_allclose(y1m12[0].array, y1[0].array)
      np.testing.assert_allclose(y1m12[1].array, y0[1].array)
      np.testing.assert_allclose(y1m12[2].array, y0[2].array)
  
      # Get at 1 and concat with None
      rs0_get1 = stateless_recurrent.get_recurrent_state_at(
          link, (h0, c0), 1, unwrap_variable=False
      )
      np.testing.assert_allclose(rs0_get1[0].array, h0.array[:, 1])
      np.testing.assert_allclose(rs0_get1[1].array, c0.array[:, 1])
      concat_rs_get1 = stateless_recurrent.concatenate_recurrent_states(
          link, [None, rs0_get1, None]
      )
      _, _, y1g1 = link(concat_rs_get1[0], concat_rs_get1[1], seqs_x)
      np.testing.assert_allclose(y1g1[0].array, y0[0].array)
      np.testing.assert_allclose(y1g1[1].array, y1[1].array)
      np.testing.assert_allclose(y1g1[2].array, y0[2].array)
  
      # Get at 1 with unwrap_variable=True
      rs0_get1 = stateless_recurrent.get_recurrent_state_at(
          link, (h0, c0), 1, unwrap_variable=True
      )
      np.testing.assert_allclose(rs0_get1[0], h0.array[:, 1])
      np.testing.assert_allclose(rs0_get1[1], c0.array[:, 1])
  
imports: import unittest
  from chainer import links
  from chainer import testing
  import numpy
  from chainerrl.links import stateless_recurrent
label_desc: Use image node_id 1 for calling the TestRecurrentStateFunctions obj's underlying member method code with example usage: obj._test_lstm(gpu) without return types