code: def _tf_transpose(x, is_sequence=False):
      if not hasattr(x, "shape"):
          return x
      if len(x.shape) == 4:
          # [Batch, Height, Width, Channels] --> [Batch, Channels, Height, Width]
          x = np.transpose(x, [0, 3, 1, 2])
          return np.expand_dims(x, axis=0)
      elif len(x.shape) == 3:
          # We only deal with non-recurrent networks for now
          # (H,W,C) --> (C,H,W)
          return np.transpose(x, [2, 0, 1])
      elif len(x.shape) == 2:
          if is_sequence:  # (N,S) --> (S,N,1,)
              return x.reshape(x.shape[::-1] + (1,))
          else:  # (N,C) --> (N,C,1,1)
              return x.reshape((1,) + x.shape)  # Dense
      elif len(x.shape) == 1:
          if is_sequence:  # (S) --> (S,N,1,1,1)
              return x.reshape((x.shape[0], 1, 1, 1, 1))
          else:
              return x
      else:
          return x
  
imports: import unittest
  import urllib
  import os
  import tarfile
  import zipfile
  import numpy
  import PIL.Image
  import tensorflow
  from tensorflow.core.framework import graph_pb2
  import tfcoreml
label_desc: Use image node_id 6 for calling a global function with example usage: _tf_transpose(x, is_sequence) and returns: x, np, np, x, x, x, x, x