.torch_interpreter.investigate_helper

experimental_experiment.torch_interpreter.investigate_helper.prepare_args_kwargs(torch_results: Dict[str, Any], node: Node) Tuple[Tuple[Any, ...], Dict[str, Any]][source]

Prepares args and kwargs before executing a fx node.

Parameters:
  • torch_results – existing results

  • node – node to execute

Returns:

new args and kwargs

experimental_experiment.torch_interpreter.investigate_helper.run_aligned(ep: ExportedProgram, onx: ModelProto | FunctionProto, args: Tuple[Tensor, ...], check_conversion_cls: Dict[str, Any] | type, kwargs: Dict[str, Any] | None = None, verbose: int = 0) Iterator[Tuple[Any, ...]][source]

Runs both the exported program and the onnx proto and looks for discrepancies.

Parameters:
  • ep – exported program

  • onx – model or function proto

  • args – input args

  • check_conversion_cls – defines the runtime to use for this task

  • kwargs – input kwargs

  • verbose – verbosity level

Returns:

a list of tuples containing the results.

experimental_experiment.torch_interpreter.investigate_helper.run_fx_node(node: Node, args: Tuple[Any, ...], kwargs: Dict[str, Any] | None = None) Tuple[Any, ...][source]

Executes a node

Parameters:
  • node – runs a node

  • args – unnamed inputs to the node

  • kwargs – named inputs to the node

Returns:

results

experimental_experiment.torch_interpreter.investigate_helper.validate_fx_outputs(node: Node, outputs: Tuple[Any, ...]) None[source]

Validates the outputs of a node using metadata stored in the node.

Parameters:
  • node – node

  • outputs – outputs

experimental_experiment.torch_interpreter.investigate_helper.validate_fx_tensor(node: Node, tensor: Tensor, expected_shape: Tuple[Any, ...]) None[source]

Validates the shape of tensor is expected.

Parameters:
  • node – node

  • tensor – tensor

  • expected_shape – expected shape