code: def pack_one_step_batch_as_sequences(xs):
      if isinstance(xs, tuple):
          return tuple(pack_one_step_batch_as_sequences(x) for x in xs)
      else:
          assert isinstance(xs, torch.Tensor)
          # xs: (B, ...)-shaped tensor
          # seqs: B-sized list of (1, ...)-shaped tensors
          seqs = [x for x in xs.split(1)]
          assert len(xs) == len(seqs)
          assert (1,) + xs.shape[1:] == seqs[0].shape
          return nn.utils.rnn.pack_sequence(seqs)
  
file_path: pfrl/pfrl/utils/recurrent.py
imports: import itertools
  import numpy
  import torch
  from torch import nn
label_desc: Use image node_id 5 for calling a global function with example usage: pack_one_step_batch_as_sequences(xs) and returns: tuple, nn