code: def batch_flatten(x):
      """
      Flatten the tensor except the first dimension.
      """
      shape = x.get_shape().as_list()[1:]
      if None not in shape:
          return tf.reshape(x, [-1, int(np.prod(shape))])
      return tf.reshape(x, tf.stack([tf.shape(x)[0], -1]))
  
imports: import numpy
  from ..compat import tfv1
  from ..tfutils.common import get_tf_version_tuple
  from .common import VariableHolder, layer_register
  from .tflayer import convert_to_tflayer_args, rename_get_variable
label_desc: Use image node_id 1 for calling a global function with example usage: batch_flatten(x) and returns: tf, tf