code: def vector_to_cmd(vector, categorical=False, return_floats=False):
      """Does the inverse transformation as cmd_to_vector()."""
      cast_fn = float if return_floats else str
      if categorical:
          command = (vector[: len(CMDS_LIST) + 1],)
          arguments = vector[len(CMDS_LIST) + 1 :]
          cmd_idx = np.argmax(command) - 1
      else:
          command, arguments = vector[:1], vector[1:]
          cmd_idx = int(round(command[0]))
  
      if cmd_idx < -0.5:
          # EOS
          return []
      if cmd_idx >= len(CMDS_LIST):
          cmd_idx = len(CMDS_LIST) - 1
  
      cmd = CMDS_LIST[cmd_idx]
      cmd_list = [cmd]
  
      if cmd in "hH":
          cmd_list.append(cast_fn(arguments[8]))  # x
      elif cmd in "vV":
          cmd_list.append(cast_fn(arguments[9]))  # y
      elif cmd in "mMlLtT":
          cmd_list.append(cast_fn(arguments[8]))  # x
          cmd_list.append(cast_fn(arguments[9]))  # y
      elif cmd in "sSqQ":
          cmd_list.append(cast_fn(arguments[6]))  # x2
          cmd_list.append(cast_fn(arguments[7]))  # y2
          cmd_list.append(cast_fn(arguments[8]))  # x
          cmd_list.append(cast_fn(arguments[9]))  # y
      elif cmd in "cC":
          cmd_list.append(cast_fn(arguments[4]))  # x1
          cmd_list.append(cast_fn(arguments[5]))  # y1
          cmd_list.append(cast_fn(arguments[6]))  # x2
          cmd_list.append(cast_fn(arguments[7]))  # y2
          cmd_list.append(cast_fn(arguments[8]))  # x
          cmd_list.append(cast_fn(arguments[9]))  # y
      elif cmd in "aA":
          cmd_list.append(cast_fn(arguments[0]))  # rx
          cmd_list.append(cast_fn(arguments[1]))  # ry
          # x-axis-rotation is always 0
          cmd_list.append(cast_fn("0"))
          # the following two flags are binary.
          cmd_list.append(
              cast_fn(1 if arguments[2] > 0.5 else 0)
          )  # large-arc-flag
          cmd_list.append(
              cast_fn(1 if arguments[3] > 0.5 else 0)
          )  # sweep-flag
          cmd_list.append(cast_fn(arguments[8]))  # x
          cmd_list.append(cast_fn(arguments[9]))  # y
  
      return cmd_list
  
imports: import io
  import numpy
  from PIL import Image
  from six.moves import zip_longest
  from skimage import draw
  import tensorflow.compat.v1
label_desc: Use image node_id 31 for calling a global function with example usage: vector_to_cmd(vector, categorical, return_floats) and returns: cmd_list, list