code: def seq_to_batch(h, flat=False):
      """convert from sequence to batch"""
      shape = h[0].get_shape().as_list()
      if not flat:
          assert len(shape) > 1
          nh = h[0].get_shape()[-1].value
          return tf.reshape(tf.concat(axis=1, values=h), [-1, nh])
      else:
          return tf.reshape(tf.stack(values=h, axis=1), [-1])
  
file_path: nni/nni/algorithms/hpo/ppo_tuner/util.py
imports: import os
  import random
  import multiprocessing
  import numpy
  import tensorflow.compat.v1
  from gym.spaces import Discrete, Box, MultiDiscrete
label_desc: Use image node_id 3 for calling a global function with example usage: seq_to_batch(h, flat) and returns: tf, tf