code: def batch_to_seq(tensor_batch, n_batch, n_steps, flat=False):
      """
      Transform a batch of Tensors, into a sequence of Tensors for recurrent policies
  
      :param tensor_batch: (TensorFlow Tensor) The input tensor to unroll
      :param n_batch: (int) The number of batch to run (n_envs * n_steps)
      :param n_steps: (int) The number of steps to run for each environment
      :param flat: (bool) If the input Tensor is flat
      :return: (TensorFlow Tensor) sequence of Tensors for recurrent policies
      """
      if flat:
          tensor_batch = tf.reshape(tensor_batch, [n_batch, n_steps])
      else:
          tensor_batch = tf.reshape(
              tensor_batch, [n_batch, n_steps, -1]
          )
      return [
          tf.squeeze(v, [1])
          for v in tf.split(
              axis=1, num_or_size_splits=n_steps, value=tensor_batch
          )
      ]
  
imports: import os
  import collections
  import functools
  import multiprocessing
  from typing import Set
  import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: batch_to_seq(tensor_batch, n_batch, n_steps, flat) and returns: unknown