Repository: pytorch
Issue: Often the documentation does not match the actual signature of the function
Labels: module: docs,triaged,module: __torch_function__

Inspecting the documentation of PyTorch, I found a large number of inconsistencies. I compared the dictionary in `torch.overrides` with the documentation of the functions themselves, and they were a reasonable number of mismatches (183). This was even after not processing the functions whose documentation did not match the brittle regex I wrote.

<details>
<summary>Script</summary>

```python
import re
from torch.overrides import get_testing_overrides
import inspect


def remove_special_args(l):
    if "*" in l: l.remove("*")
    if "" in l: l.remove("")  # Empty signature
    # We remove these for now,
    # We will treate them in a future postprocessing
    if "out" in l: l.remove("out")
    if "tensor" in l: l.remove("tensor")
    if "input" in l: l.remove("input")
    if "self" in l: l.remove("self")


get_arg_name = re.compile("(.*)=")
def parse_arg(arg):
    arg = arg.strip()
    match = get_arg_name.match(arg)
    if match:
        arg = match.group(1)
    return arg


def parse_signature(signature):
    return [parse_arg(arg) for arg in signature.split(",")]


i = 0
is_signature = re.compile(".*\((.*)\) -> .*")
for func, lamb in get_testing_overrides().items():
    doc = func.__doc__
    if doc is None:
        continue
    signature = re.split(r"\n\n", doc)[0].strip("\n")
    match = is_signature.match(signature)
    # If the docs have an odd formatting we omit them for now
    if match is None:
        continue
    raw_signature = match.group(1)
    parsed_signature = parse_signature(raw_signature)
    overrides_signature = list(lamb.__code__.co_varnames)
    remove_special_args(parsed_signature)
    remove_special_args(overrides_signature)
    if parsed_signature != overrides_signature:
        print(raw_signature)
        print(f"Documentation: {parsed_signature}")
        print(f"Overrides: {overrides_signature}")
        print()
        i += 1

print(f"Number of mismatches: {i}")
```

</details>

At times neither the docs nor the arguments in `overrides.py` match the actual signature. Even worse, the names for some arguments of some functions change as their types change. See for example `torch.where`:
```python
>>> torch.where()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: where() received an invalid combination of arguments - got (), but expected one of:
 * (Tensor condition)
 * (Tensor condition, Tensor input, Tensor other)
 * (Tensor condition, Number self, Tensor other)
 * (Tensor condition, Tensor input, Number other)
 * (Tensor condition, Number self, Number other)
```
while, [in the documentation](https://pytorch.org/docs/stable/generated/torch.where.html), the arguments are referred to as `x` and `y`.

I think I should be able to make these three signatures match in a consistent way for all (most?) functions in PyTorch, but before that, we would have to settle on how to handle these inconsistencies.

cc @hameerabbasi @rgommers @peterbell10 @brianjo @mruberry