pytorch / pytorch/executorch

Export API to take in example inputs and calibration inputs

Open
#12,313 0 comments 0 reactions 1 assignee View on GitHub

@abhinaykukkadapu is already working on this.

Since Jul 9, 2025.

Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

🚀 The feature, motivation and pitch

Today we have a single arg example_inputs in the export() api, the proposal here is to add another param called calibration_inputs that is intended for static quantization, example_inputs will be only used for in the torch.export.export stage.

https://github.com/pytorch/executorch/blob/main/export/export.py#L429

def export(
    model: Union[nn.Module, Dict[str, nn.Module]],
    example_inputs: Union[
        List[tuple[torch.Tensor, ...]], Dict[str, List[tuple[torch.Tensor, ...]]]
    ],
    export_recipe: ExportRecipe,
    name: Optional[str] = None,
    dynamic_shapes: Optional[Union[Any, Dict[str, Any]]] = None,
    constant_methods: Optional[Union[Dict[str, Callable]]] = None,
    artifact_dir: Optional[str] = None,
) -> "ExportSession":

In the context of recipes, if user passed a recipe that requires calibration data but instead provided only example inputs, we will error out.

CC: @kimishpatel, @metascroy, @cbilgin

Alternatives

No response

Additional context

No response

RFC (Optional)

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.