torch.fx.operator_schemas.normalize_function
- torch.fx.operator_schemas.normalize_function(target, args, kwargs=None, arg_types=None, kwarg_types=None, normalize_to_only_use_kwargs=False)
Returns normalized arguments to PyTorch functions. This means that
args/kwargs will be matched up to the functional’s
signature and return exclusively kwargs in positional order if
normalize_to_only_use_kwargs is True.
Also populates default values. Does not support positional-only
parameters or varargs parameters (*args, **kwargs). Does not support modules.
May require arg_types and kwarg_types in order to disambiguate overloads.
target (Callable) – Function that we are normalizing
args (Tuple[Any]) – Tuple of args to the function
kwargs (Optional[Dict[str, Any]]) – Dict of kwargs to the function
arg_types (Optional[Tuple[Any]]) – Tuple of arg types for the args
kwarg_types (Optional[Dict[str, Any]]) – Dict of arg types for the kwargs
normalize_to_only_use_kwargs (bool) – Whether to normalize to only use kwargs.
Returns normalized_args_and_kwargs, or None if not successful.
ArgsKwargsPair | None