code: def concatenate_recurrent_states(link, split_recurrent_states):
      if isinstance(link, L.NStepLSTM):
          # shape: (n_layers, batch_size, out_size)
          n_layers = link.n_layers
          out_size = link.out_size
          xp = link.xp
          hs = []
          cs = []
          for srs in split_recurrent_states:
              if srs is None:
                  h = xp.zeros(
                      (n_layers, 1, out_size), dtype=np.float32
                  )
                  c = xp.zeros(
                      (n_layers, 1, out_size), dtype=np.float32
                  )
              else:
                  h, c = srs
                  if h.ndim == 2:
                      assert h.shape == (n_layers, out_size)
                      assert c.shape == (n_layers, out_size)
                      # add batch axis
                      h = h[:, None]
                      c = c[:, None]
              hs.append(h)
              cs.append(c)
          h = F.concat(hs, axis=1)
          c = F.concat(cs, axis=1)
          return (h, c)
      if isinstance(link, (L.NStepGRU, L.NStepRNNReLU, L.NStepRNNTanh)):
          n_layers = link.n_layers
          out_size = link.out_size
          xp = link.xp
          hs = []
          for srs in split_recurrent_states:
              if srs is None:
                  h = xp.zeros(
                      (n_layers, 1, out_size), dtype=np.float32
                  )
              else:
                  h = srs
                  if h.ndim == 2:
                      assert h.shape == (n_layers, out_size)
                      # add batch axis
                      h = h[:, None]
              hs.append(h)
          h = F.concat(hs, axis=1)
          return h
      if isinstance(link, StatelessRecurrent):
          return link.concatenate_recurrent_states(
              split_recurrent_states
          )
      else:
          raise ValueError("{} is not a recurrent link".format(link))
  
imports: from cached_property import cached_property
  import chainer
  import chainer.functions
  import chainer.links
  import numpy
label_desc: Use image node_id 11 for calling a global function with example usage: concatenate_recurrent_states(link, split_recurrent_states) and returns: h,  c, h, link