Generate complete annotations for `torch._C._nn`
Labels: module: typing, triaged, enhancement, release notes: devx

### 🚀 The feature, motivation and pitch

This is a follow-up of #102918 and a sub-task of #103761.

This is not user-facing and only involves changes in the type stub of `torch._C._nn` which is an internal module.

#102918 has introduced annotations for some functions in `torch._C._nn` so that the end-users can see correct typing for public APIs exposed through `torch.nn.functional`. There's also a TODO left in that PR because there're many functions not covered by it which do not directly contribute to the publicly visible APIs.
https://github.com/pytorch/pytorch/blob/918fe519a0f9bdb2dd213eaaffbcd420b7391280/tools/pyi/gen_pyi.py#L299

However, this is not enough for the goal in #103761. When we remove the pyi type stub, mypy will look into more details of `torch.nn.functional` and throw errors about undefined attributes in `torch._C._nn`, which are only internally used and not covered by #102918.

<details>
<summary>Related error logs</summary>

```log
torch/nn/functional.py:766:12: error: Module has no attribute "max_pool2d_with_indices"  [attr-defined]
torch/nn/functional.py:852:12: error: Module has no attribute "max_pool3d_with_indices"  [attr-defined]
torch/nn/functional.py:957:12: error: Module has no attribute "max_unpool2d"  [attr-defined]
torch/nn/functional.py:989:12: error: Module has no attribute "max_unpool2d"  [attr-defined]
torch/nn/functional.py:1021:12: error: Module has no attribute "max_unpool3d"  [attr-defined]
torch/nn/functional.py:1232:12: error: Module has no attribute "adaptive_avg_pool2d"; maybe "adaptive_max_pool2d" or "adaptive_max_pool3d"?  [attr-defined]
torch/nn/functional.py:1249:12: error: Module has no attribute "adaptive_avg_pool3d"; maybe "adaptive_max_pool3d" or "adaptive_max_pool2d"?  [attr-defined]
torch/nn/functional.py:1511:12: error: Module has no attribute "glu"; maybe "gelu"?  [attr-defined]
torch/nn/functional.py:1550:18: error: Module has no attribute "relu6_"; maybe "elu_"?  [attr-defined]
torch/nn/functional.py:1552:18: error: Module has no attribute "relu6"  [attr-defined]
torch/nn/functional.py:1566:18: error: Module has no attribute "elu"; maybe "gelu" or "elu_"?  [attr-defined]
torch/nn/functional.py:2007:16: error: Module has no attribute "hardsigmoid_"; maybe "hardsigmoid"?  [attr-defined]
torch/nn/functional.py:2076:16: error: Module has no attribute "silu_"  [attr-defined]
torch/nn/functional.py:2077:12: error: Module has no attribute "silu"  [attr-defined]
torch/nn/functional.py:2095:16: error: Module has no attribute "mish_"  [attr-defined]
torch/nn/functional.py:2096:12: error: Module has no attribute "mish"  [attr-defined]
torch/nn/functional.py:2119:16: error: Module has no attribute "hardswish_"  [attr-defined]
torch/nn/functional.py:2120:12: error: Module has no attribute "hardswish"  [attr-defined]
torch/nn/functional.py:2737:12: error: Module has no attribute "nll_loss_nd"  [attr-defined]
torch/nn/functional.py:3061:12: error: Module has no attribute "cross_entropy_loss"  [attr-defined]
torch/nn/functional.py:3130:12: error: Module has no attribute "binary_cross_entropy"  [attr-defined]
torch/nn/functional.py:3243:16: error: Module has no attribute "l1_loss"  [attr-defined]
torch/nn/functional.py:3245:16: error: Module has no attribute "smooth_l1_loss"  [attr-defined]
torch/nn/functional.py:3275:12: error: Module has no attribute "huber_loss"  [attr-defined]
torch/nn/functional.py:3306:12: error: Module has no attribute "l1_loss"  [attr-defined]
torch/nn/functional.py:3337:12: error: Module has no attribute "mse_loss"  [attr-defined]
torch/nn/functional.py:3434:12: error: Module has no attribute "multilabel_margin_loss"  [attr-defined]
torch/nn/functional.py:3456:12: error: Module has no attribute "soft_margin_loss"  [attr-defined]
torch/nn/functional.py:3575:12: error: Module has no attribute "multi_margin_loss"  [attr-defined]
torch/nn/functional.py:4748:12: error: Module has no attribute "im2col"  [attr-defined]
torch/nn/functional.py:4770:12: error: Module has no attribute "col2im"  [attr-defined]
```
</details>

### Alternatives

Add a hundred `type:ignore`s in `torch/nn/functional.py` when working on #103761. (Obviously not good)

### Additional context

There should be a better way to engineer it -- instead of manually annotating each function, it could be possible to generate the function signatures automatically. I'm currently looking into it.

cc @ezyang @malfet @rgommers @xuzhao9 @gramster