experimental_experiment.torch_interpreter.dispatcher

class experimental_experiment.torch_interpreter.dispatcher.ForceDispatcher(signatures: Dict[str, Callable] | None = None, verbose: int = 0, domain: str = 'aten.lib', version: int = 1, strict: bool = False, only_registered: bool = False)[source]

Implements a dispatcher which fails whenever there is no converting for a node in the fx graph. There is no fallback to the existing functions. When no function is found, an onnx node is added with a non standard domain.

Parameters:
  • signatures – function used only for their signature mapping a name to a function in order to have parameter names

  • verbose – verbose

  • domain – domain of the added node

  • version – version of the domain

  • strict – when an input is not a tensor, it becomes a named parameter if strict is False

  • only_registered – fails if a function is not found in signatures

fallback(name: Any, fct: Callable | None, args: List[Any], kwargs: Dict[str, Any], builder: GraphBuilder) Callable | None[source]

The function is called after the function converting an aten function into ONNX. fct is this function. It can be changed and just set when mapping was found.

Parameters:
  • name – object or str

  • fct – function found so far

  • args – known arguments coming from the graph module

  • kwargs – known named arguments coming from the graph module

  • builder – GraphBuilder

Returns:

callable