class_docstr: Singleton builder.
  
  Example:
  
  from coremltools.converters.mil.mil import Builder as mb
  from coremltools.converters.mil.mil import Program, Function
  
  prog = Program()
  func_inputs = {"x": mb.placeholder(_shape=[2,3]),
                 "y": mb.placeholder(_shape=[2,3])}
  with Function(func_inputs) as ssa_fun:
    x, y = ssa_fun.inputs['x'], ssa_fun.inputs['x']
    res_var = mb.add(x=x, y=y) # created within ssa_fun block
    ssa_fun.set_outputs([res_var])
  prog.add_function("main", ssa_fun)
docstr: 1. Create Var for optional input types with default values that's not
  specified.
  
  2. Convert python primitive types to Var.
  
  Inputs:
  
  input_spec (InputSpec)
  op_name (str): op name.
  before_op: created all vars / const op will come right before
             `before_op` in the block's order. None to append at the end.
docstr_tok: ["1",".","Create","Var","for","optional","input","types","with","default","values","that","'s","not","specified",".","2",".","Convert","python","primitive","types","to","Var",".","Inputs",":","input_spec","(","InputSpec",")","op_name","(","str",")",":","op","name",".","before_op",":","created","all","vars","\/","const","op","will","come","right","before","`","before_op","`","in","the","block","'s","order",".","None","to","append","at","the","end","."]
code: def _create_input_vars(
      cls, input_spec, op_name, op_cls, before_op, kwargs
  ):
      """
      1. Create Var for optional input types with default values that's not
      specified.
  
      2. Convert python primitive types to Var.
  
      Inputs:
  
      input_spec (InputSpec)
      op_name (str): op name.
      before_op: created all vars / const op will come right before
                 `before_op` in the block's order. None to append at the end.
      """
      update_dict = {}
      for in_name, in_type in input_spec.input_types.items():
          new_var_name = op_name + "_" + in_name
          if not in_type.optional and in_name not in kwargs:
              raise ValueError(
                  "Input '{}' is required for op '{}'.".format(
                      in_name, op_cls.__name__
                  )
              )
  
          if in_name in kwargs and isinstance(kwargs[in_name], Var):
              # check const
              if in_type.const and kwargs[in_name].val is None:
                  msg = "Input '{}' of op '{}' ({}) must be const at compile time."
                  raise ValueError(
                      msg.format(in_name, op_name, op_cls.__name__)
                  )
  
          elif in_name in kwargs:
              # Provided value is not Var. Create a Var from kwargs[in_name]
              val = kwargs[in_name]
              # create Var for numpy / python primitive
              if isinstance(in_type, InternalInputType):
                  # Shove all internal inputs to InternalVar (unknown type).
                  var = InternalVar(val, name=new_var_name)
                  curr_block().add_internal_var(var)
              else:
                  if isinstance(in_type, TupleInputType):
                      var = []
                      for i, v in enumerate(val):
                          if isinstance(v, Var):
                              var.append(v)
                              continue
                          var.append(
                              cls._add_const(
                                  v, new_var_name + str(i), before_op
                              )
                          )
                  elif isinstance(in_type, ScalarOrTensorInputType):
                      var = cls._add_const(val, new_var_name, before_op)
                  else:
                      msg = "Cannot convert input '{}' of type {} to Var (op: {})"
                      raise ValueError(
                          msg.format(
                              in_name, type(in_type).__name__, op_name
                          )
                      )
              update_dict[in_name] = var
  
          elif in_name not in kwargs and in_type.default is not None:
              if isinstance(in_type, PyFunctionInputType):
                  msg = "Default value is not allowed for PyFunctionInputType"
                  raise ValueError(msg)
              # Create a Var from the default value.
              if is_internal_input(in_name):
                  var = InternalVar(in_type.default, name=new_var_name)
                  curr_block().add_internal_var(var)
              elif isinstance(in_type, TupleInputType):
                  var = tuple(
                      cls._add_const(
                          v, new_var_name + str(i), before_op
                      )
                      for i, v in enumerate(in_type.default)
                  )
              else:
                  var = cls._add_const(
                      in_type.default, new_var_name, before_op
                  )
              update_dict[in_name] = var
  
      kwargs.update(update_dict)
  
      return kwargs
  
imports: from collections import defaultdict
  import copy
  import logging
  import six
  import numbers
  import numpy
  from coremltools.converters.mil.mil.types.symbolic import any_symbolic
  from .None import curr_block, Program, Function, Placeholder, is_internal_input
  from .input_type import _InputType, InternalStringInputType, InternalScalarOrTensorInputType, ScalarOrTensorInputType, TupleInputType, InputSpec, InternalInputType, PyFunctionInputType
  from .var import InternalVar, Var
  from .ops import defs
label_desc: Use image node_id 4 for calling the Builder obj's underlying member method code with example usage: obj._create_input_vars(cls, input_spec, op_name, op_cls, before_op, kwargs) and returns: kwargs