code: def _get_input_vars(op, only_nonconst_vars=False):
      """
      :return: List[Var]
      """
      input_vars = []
      for name, val in op.inputs.items():
          if isinstance(val, Var):
              if only_nonconst_vars:
                  if val.op and val.op.op_type == "const":
                      continue
              input_vars.append(val)
          elif isinstance(val, (list, tuple)):
              for var in val:
                  if not isinstance(var, Var):
                      msg = "transpose optimization pass: unrecognized input type of op='{}', input='{}'"
                      raise ValueError(msg.format(op.name, name))
                  if only_nonconst_vars:
                      if var.op and var.op.op_type == "const":
                          continue
                  input_vars.append(var)
          else:
              msg = "transpose optimization pass: unrecognized input type of op='{}', input='{}'"
              raise ValueError(msg.format(op.name, name))
      return input_vars
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil.var import Var
  import logging
  import numpy
  import copy
  from collections import defaultdict
label_desc: Use image node_id 2 for calling a global function with example usage: _get_input_vars(op, only_nonconst_vars) and returns: input_vars