MCPcopy Create free account
hub / github.com/pytorch/executorch / _load_example_inputs

Function _load_example_inputs

backends/arm/scripts/aot_arm_compiler.py:86–101  ·  view source on GitHub ↗

Load example inputs from a `.pt` file when a path is provided.

(model_input: str | None)

Source from the content-addressed store, hash-verified

84
85
86def _load_example_inputs(model_input: str | None) -> Any: # nosec B614
87 """Load example inputs from a `.pt` file when a path is provided."""
88 if model_input is None:
89 return None
90
91 logging.info(f"Load model input from {model_input}")
92
93 if model_input.endswith(".pt"):
94 return torch.load(
95 model_input, weights_only=False
96 ) # nosec B614 trusted artifacts
97
98 raise RuntimeError(
99 f"Model input data '{model_input}' is not a valid name. Use --model_input "
100 "<FILE>.pt e.g. saved with torch.save()"
101 )
102
103
104def _load_internal_model(

Callers 1

Calls 2

infoMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected