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: Usage:
  
  @mb.program(input_specs=[mb.TensorSpec(shape=(1,2))])
  def prog(a):
      return mb.add(x=a, y=2)
docstr_tok: ["Usage",":","@","mb.program","(","input_specs=","[","mb.TensorSpec","(","shape=","(","1,2",")",")","]",")","def","prog","(","a",")",":","return","mb.add","(","x=a",",","y=2",")"]
code: def program(input_specs=None):
      """
      Usage:
  
      @mb.program(input_specs=[mb.TensorSpec(shape=(1,2))])
      def prog(a):
          return mb.add(x=a, y=2)
      """
      if input_specs is None:
          input_specs = []
  
      def wrapper(main_block):
          program = Program()
          num_args = main_block.__code__.co_argcount
          arg_names = list(main_block.__code__.co_varnames)[:num_args]
          if len(input_specs) != num_args:
              msg = "{} expects {} inputs: {}. Got {} input_specs."
              raise ValueError(
                  msg.format(
                      main_block.__name__,
                      num_args,
                      arg_names,
                      len(input_specs),
                  )
              )
          input_spec_dict = {
              k: v for k, v in zip(arg_names, input_specs)
          }
          with Function(input_spec_dict) as func:
              input_vars = [func.inputs[a] for a in arg_names]
              outputs = main_block(*input_vars)
              if isinstance(outputs, tuple):
                  outputs = list(outputs)
              elif not isinstance(outputs, list):
                  outputs = [outputs]
              func.set_outputs(outputs)
              program.add_function("main", func)
          return program
  
      return wrapper
  
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 8 for calling the Builder obj's underlying member method code with example usage: obj.program(input_specs) and returns: wrapper, program