@@ -605,13 +605,13 @@ provides a developer-facing API for ensuring full support for
605605changes without warning in the future.
606606
607607First, to get a listing of all overridable functions, use
608- ``torch._overrides .get_overridable_functions ``. This returns a dictionary whose
608+ ``torch.overrides .get_overridable_functions ``. This returns a dictionary whose
609609keys are namespaces in the ``PyTorch `` Python API and whose values are a list of
610610functions in that namespace that can be overriden. For example, let's print the
611611names of the first 5 functions in ``torch.nn.functional `` that can be
612612overriden::
613613
614- >>> from torch._overrides import get_overridable_functions
614+ >>> from torch.overrides import get_overridable_functions
615615 >>> func_dict = get_overridable_functions()
616616 >>> nn_funcs = func_dict[torch.nn.functional]
617617 >>> print([f.__name__ for f in nn_funcs[:5])
@@ -622,20 +622,20 @@ This listing of functions makes it possible to iterate over all overridable
622622functions, however in practice this is not enough to write tests for all of
623623these functions without laboriously and manually copying the signature of each
624624function for each test. To ease this process, the
625- ``torch._overrides .get_testing_overrides `` function returns a dictionary mapping
625+ ``torch.overrides .get_testing_overrides `` function returns a dictionary mapping
626626overridable functions in the ``PyTorch `` API to dummy lambda functions that have
627627the same signature as the original function but unconditionally return -1. These
628628functions are most useful to use with ``inspect `` to analyze the function
629629signature of the original ``PyTorch `` function::
630630
631631 >>> import inspect
632- >>> from torch._overrides import get_testing_overrides
632+ >>> from torch.overrides import get_testing_overrides
633633 >>> override_dict = get_testing_overrides()
634634 >>> dummy_add = override_dict[torch.add]
635635 >>> inspect.signature(dummy_add)
636636 <Signature (input, other, out=None)>
637637
638- Finally, ``torch._overrides .get_ignored_functions `` returns a tuple of functions
638+ Finally, ``torch.overrides .get_ignored_functions `` returns a tuple of functions
639639that explicitly cannot be overrided by ``__torch_function__ ``. This list can be
640640useful to confirm that a function that isn't present in the dictionary returned
641641by ``get_overridable_functions `` cannot be overriden.
0 commit comments