class_docstr: This class is a singleton builder to construct a MIL program. For more
  information, see `Create a MIL program <https://coremltools.readme.io/docs/model-intermediate-language#create-a-mil-program>`_.
  
  Importing ``.ops`` triggers the installation of all MIL ops into the Builder.
  For details on each op, see `MIL ops <https://apple.github.io/coremltools/source/coremltools.converters.mil.mil.ops.defs.html>`_.
  
  Examples
  --------
  
  >>> 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['y']
  >>>   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)
  
  >>> # Importing ops triggers installation of all ops into Builder.
  >>> from .ops import defs as _ops
docstr: The ``mb.function`` decorator creates a MIL function.
  
  Parameters
  ----------
  input_specs: List[TensorSpec]
      Describes the function inputs
  
  opset_version: AvailableTarget enum
      Describes the opset version of the function
  
  Examples
  --------
  >>> import coremltools as ct
  >>> @mb.function(input_specs=[mb.TensorSpec(shape=(1,2))], opset_version=ct.target.iOS16)
  >>> def func(a):
  >>>     return mb.add(x=a, y=2)
docstr_tok: ["The","``","mb.function","``","decorator","creates","a","MIL","function",".","Parameters","--","--","--","--","--","input_specs",":","List","[","TensorSpec","]","Describes","the","function","inputs","opset_version",":","AvailableTarget","enum","Describes","the","opset","version","of","the","function","Examples","--","--","--","--",">",">",">","import","coremltools","as","ct",">",">",">","@","mb.function","(","input_specs=","[","mb.TensorSpec","(","shape=","(","1,2",")",")","]",",","opset_version=ct.target.iOS16",")",">",">",">","def","func","(","a",")",":",">",">",">","return","mb.add","(","x=a",",","y=2",")"]
code: def function(
      input_specs: Optional[List[Placeholder]] = None,
      opset_version: Optional[AvailableTarget] = None,
  ):
      """
      The ``mb.function`` decorator creates a MIL function.
  
      Parameters
      ----------
      input_specs: List[TensorSpec]
          Describes the function inputs
  
      opset_version: AvailableTarget enum
          Describes the opset version of the function
  
      Examples
      --------
      >>> import coremltools as ct
      >>> @mb.function(input_specs=[mb.TensorSpec(shape=(1,2))], opset_version=ct.target.iOS16)
      >>> def func(a):
      >>>     return mb.add(x=a, y=2)
  
      """
  
      def wrapper(main_block):
          return Builder._create_function(
              main_block, input_specs, opset_version
          )
  
      return wrapper
  
imports: import numbers
  from collections import defaultdict
  from typing import Callable, List, Optional
  import numpy
  from coremltools import _logger
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget
  from coremltools.converters.mil.mil.types.symbolic import any_symbolic
  from .block import Function, curr_block
  from .input_type import InternalInputType, ListOrTensorInputType, TensorInputType, TupleInputType
  from .program import Placeholder, Program
  from .var import InternalVar, Var
label_desc: Use image node_id 9 for calling the Builder obj's underlying member method code with example usage: obj.function(input_specs, opset_version) and returns: wrapper, Builder