class_docstr: Represents Operation in MIL.
  
  # Properties
  name (str):
      The name of the operation
  
  input_types (InputSpec, class attr):
      Read-only named input types from all subclasses. Input types are used
      to validate `inputs`.
      If an input arg name start with prefix `_`, that indicates the input has the following properties:
      1. Most of the time, the input is type of ``InternalInputType`` and
         used only in pymil scope. It doesn't have the corresponding arg / attr
         in the MIL framework definition.
      2. It won't be printed in pymil.
  
  inputs [_input_vars] (dict of str --> Var):
      An Operation (subclass of Operation) only has access to input Var,
      which is already validated against `input_spec`.
  
  outputs [_output_vars] (list of Var):
      List of output var based on type inference. Read-only
class_docstr_tok: ["Represents","Operation","in","MIL",".","#","Properties","name","(","str",")",":","The","name","of","the","operation","input_types","(","InputSpec",",","class","attr",")",":","Read-only","named","input","types","from","all","subclasses",".","Input","types","are","used","to","validate","`","inputs","`",".","If","an","input","arg","name","start","with","prefix","`","_","`",",","that","indicates","the","input","has","the","following","properties",":","1",".","Most","of","the","time",",","the","input","is","type","of","``","InternalInputType","``","and","used","only","in","pymil","scope",".","It","does","n't","have","the","corresponding","arg","\/","attr","in","the","MIL","framework","definition",".","2",".","It","wo","n't","be","printed","in","pymil",".","inputs","[","_input_vars","]","(","dict","of","str","--",">","Var",")",":","An","Operation","(","subclass","of","Operation",")","only","has","access","to","input","Var",",","which","is","already","validated","against","`","input_spec","`",".","outputs","[","_output_vars","]","(","list","of","Var",")",":","List","of","output","var","based","on","type","inference",".","Read-only"]
docstr: For each k, v in `input_kvs`, perform the following:
  
  - Check k exists in `self.input_specs`
  - Check that v satisfies the correspodning `InputType`
  - Set input, possibly replacing existing input.
  
  Note that it does not ensure all required inputs are satisfied.
  Use _ensure_required_inputs() for that.
  
  Parameters
  ----------
  - input_kvs: Dict[str, Var]
    Each key in input_kvs must exist in `self.input_specs`. Its values
    must be a Var.
  
  - no_check_var_types: bool
    True to check var types against input_specs only, but not
    enforcing new input vars to be a subtype of existing input vars
docstr_tok: ["For","each","k",",","v","in","`","input_kvs","`",",","perform","the","following",":","-","Check","k","exists","in","`","self.input_specs","`","-","Check","that","v","satisfies","the","correspodning","`","InputType","`","-","Set","input",",","possibly","replacing","existing","input",".","Note","that","it","does","not","ensure","all","required","inputs","are","satisfied",".","Use","_ensure_required_inputs","(",")","for","that",".","Parameters","--","--","--","--","--","-","input_kvs",":","Dict","[","str",",","Var","]","Each","key","in","input_kvs","must","exist","in","`","self.input_specs","`",".","Its","values","must","be","a","Var",".","-","no_check_var_types",":","bool","True","to","check","var","types","against","input_specs","only",",","but","not","enforcing","new","input","vars","to","be","a","subtype","of","existing","input","vars"]
code: def _validate_and_set_inputs(
      self, input_kvs, no_check_var_types=False
  ):
      """
      For each k, v in `input_kvs`, perform the following:
  
      - Check k exists in `self.input_specs`
      - Check that v satisfies the correspodning `InputType`
      - Set input, possibly replacing existing input.
  
      Note that it does not ensure all required inputs are satisfied.
      Use _ensure_required_inputs() for that.
  
      Parameters
      ----------
      - input_kvs: Dict[str, Var]
        Each key in input_kvs must exist in `self.input_specs`. Its values
        must be a Var.
  
      - no_check_var_types: bool
        True to check var types against input_specs only, but not
        enforcing new input vars to be a subtype of existing input vars
      """
      for key in input_kvs.keys():
          if key not in self._input_types:
              raise RuntimeError(
                  "Unknown input '{}' for op '{}'".format(
                      key, self.op_type
                  )
              )
  
      def check_and_detach(v_new, v_old, op, no_check_var_types):
          # Check new var's sym_type is compatible with the
          # existing's sym_type.
          if (
              not is_compatible_type(v_new.sym_type, v_old.sym_type)
              and not no_check_var_types
          ):
              raise ValueError(
                  f"New var type `{v_new.sym_type}` not a "
                  f"subtype of existing var type `{v_old.sym_type}`."
              )
          v_old.remove_child_op(op, no_check_var_types)
  
      self.input_spec.validate_inputs(
          self.name, self.op_type, input_kvs
      )
  
      for name, var in input_kvs.items():
          # Remove this operation itself from existing input
          # Var's child_ops
          existing_input_var = self._input_vars[name]
          if existing_input_var is not None:
              if isinstance(existing_input_var, (list, tuple)):
                  for v_old, v_new in zip(existing_input_var, var):
                      check_and_detach(
                          v_new, v_old, self, no_check_var_types
                      )
              else:
                  check_and_detach(
                      var, existing_input_var, self, no_check_var_types
                  )
  
          # Set var as input_var
          if isinstance(var, Var):
              # TODO: the child op of complex op's input might get lost, as the complex op will
              # be lowered. Maybe should add child op here and take care of it in lowering pass.
              var.add_child_op(self)
          elif isinstance(var, (tuple, list)):
              for v in var:
                  v.add_child_op(self)
          # ignore function inputs
          self._input_vars[name] = var
          setattr(self, name, var)
  
imports: from typing import Any, Dict, Tuple
  import numpy
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.types import is_compatible_type
  from coremltools.converters.mil.mil.types.symbolic import any_symbolic, is_symbolic
  from .None import SPACES
  from .input_type import DefaultInputs, TensorInputType, TupleInputType
  from .var import ComplexVar, InternalVar, ListVar, Var
label_desc: Use image node_id 13 for calling the Operation obj's underlying member method code with example usage: obj._validate_and_set_inputs(input_kvs, no_check_var_types) without return types