Rate this Page

torch.fx.operator_schemas.get_signature_for_torch_op#

torch.fx.operator_schemas.get_signature_for_torch_op(op: Callable[[...], Any], return_schemas: Literal[True]) tuple[list[Signature] | None, list[FunctionSchema] | None][source]#
torch.fx.operator_schemas.get_signature_for_torch_op(op: Callable[[...], Any], return_schemas: Literal[False] = False) list[Signature] | None

Given an operator on the torch namespace, return a list of inspect.Signature objects corresponding to the overloads of that op.. May return None if a signature could not be retrieved.

Parameters:

op (Callable) – An operator on the torch namespace to look up a signature for

Returns:

A list of signatures for the overloads of this

operator, or None if the operator signatures could not be retrieved. If return_schemas=True, returns a tuple containing the optional Python signatures and the optional TorchScript Function signature

Return type:

Optional[List[inspect.Signature]]

Warning

This API is experimental and is NOT backward-compatible.