gopikrsmscs/torch-issues huggingface dataset:
pytorch could not build from source with cudnn 8.0.5
Labels: module: build, module: cudnn, module: cuda, triaged

### 🐛 Describe the bug

pytorch could not build from source with cudnn 8.0.5, since cudnn-frontend in thirdparty will use `CUDNN_DATA_INT64` and other API such as `CUDNN_POINTWISE_RELU_BWD`, whereas CUDNN 8.0.5 API seems not to have (https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-805/api/index.html).
```
pytorch/cmake/../third_party/cudnn_frontend/include/cudnn_frontend_utils.h: In function 'std::__cxx11::string cudnn_frontend::to_string(cudnnDataType_t)':
pytorch/cmake/../third_party/cudnn_frontend/include/cudnn_frontend_utils.h:93:14: error: 'CUDNN_DATA_INT64' was not declared in this scope
         case CUDNN_DATA_INT64:
              ^~~~~~~~~~~~~~~~
pytorch/cmake/../third_party/cudnn_frontend/include/cudnn_frontend_utils.h:93:14: note: suggested alternative: 'CUDNN_DATA_INT8x4'
         case CUDNN_DATA_INT64:
              ^~~~~~~~~~~~~~~~
              CUDNN_DATA_INT8x4
pytorch/cmake/../third_party/cudnn_frontend/include/cudnn_frontend_utils.h:95:14: error: 'CUDNN_DATA_BFLOAT16' was not declared in this scope
         case CUDNN_DATA_BFLOAT16:
              ^~~~~~~~~~~~~~~~~~~
pytorch/cmake/../third_party/cudnn_frontend/include/cudnn_frontend_utils.h:95:14: note: suggested alternative: 'CUDNN_DATA_FLOAT'
         case CUDNN_DATA_BFLOAT16:
              ^~~~~~~~~~~~~~~~~~~
              CUDNN_DATA_FLOAT
```


### Versions

Pytorch 1.12.0

cc @malfet @seemethere @csarofeen @ptrblck @xwang233 @ngimel
ipykernel crash importing torch after scipy in .ipynb file
Labels: needs reproduction, module: crash, triaged

### 🐛 Describe the bug

I'm working in a .ipynb notebook in VSCode on an Intel MacBook (late 2016 MBP)

Conda environment setup as:
```
% conda create --prefix ./envs/scipy
% conda activate ./envs/scipy
% conda install pytorch=1.12.1 -c pytorch
% conda install scipy
% conda install ipython ipykernel
```

As first cell in notebook, this causes kernel crash
```
from scipy.optimize import least_squares
import torch
```

This does not:
```
import torch
from scipy.optimize import least_squares
```

### Versions

Collecting environment information...
PyTorch version: 1.12.1
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.6 (x86_64)
GCC version: Could not collect
Clang version: 14.0.0 (clang-1400.0.29.102)
CMake version: Could not collect
Libc version: N/A

Python version: 3.10.6 (main, Oct  7 2022, 15:17:23) [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.3
[pip3] torch==1.12.1
[conda] blas                      1.0                         mkl  
[conda] mkl                       2021.4.0           hecd8cb5_637  
[conda] mkl-service               2.4.0           py310hca72f7f_0  
[conda] mkl_fft                   1.3.1           py310hf879493_0  
[conda] mkl_random                1.2.2           py310hc081a56_0  
[conda] numpy                     1.23.3          py310hc1140d4_0  
[conda] numpy-base                1.23.3          py310h2a77c02_0  
[conda] pytorch                   1.12.1                 py3.10_0    pytorch
[Bug]: AssertionError: ABCMeta
Labels: triaged, bug, oncall: pt2

### 🐛 Describe the bug

Turn off error suppression and run test_sort_out in test_sort_out

```
  File "/raid/ezyang/pytorch-scratch2/torch/_dynamo/variables/functions.py", line 62, in call_function      
    return tx.inline_user_function_return(                                                                  
  File "/raid/ezyang/pytorch-scratch2/torch/_dynamo/symbolic_convert.py", line 293, in inline_user_function_
return                                                                                                      
    result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)                              
  File "/raid/ezyang/pytorch-scratch2/torch/_dynamo/symbolic_convert.py", line 1519, in inline_call         
    return cls.inline_call_(parent, func, args, kwargs)                                                     
  File "/raid/ezyang/pytorch-scratch2/torch/_dynamo/symbolic_convert.py", line 1547, in inline_call_        
    sub_locals, closure_cells = func.bind_args(parent, args, kwargs)                                          File "/raid/ezyang/pytorch-scratch2/torch/_dynamo/variables/functions.py", line 126, in bind_args         
    fake_func.__kwdefaults__ = {                                                                            
  File "/raid/ezyang/pytorch-scratch2/torch/_dynamo/variables/functions.py", line 127, in <dictcomp>        
    k: wrap(v) for k, v in fn.__kwdefaults__.items()                                                          File "/raid/ezyang/pytorch-scratch2/torch/_dynamo/variables/functions.py", line 23, in wrap_bound_arg     
    return cls([wrap_bound_arg(x, options) for x in val], **options)                                        
  File "/raid/ezyang/pytorch-scratch2/torch/_dynamo/variables/functions.py", line 23, in <listcomp>         
    return cls([wrap_bound_arg(x, options) for x in val], **options)                                          File "/raid/ezyang/pytorch-scratch2/torch/_dynamo/variables/functions.py", line 29, in wrap_bound_arg     
    assert isinstance(val, VariableTracker), typestr(val)                                                   
AssertionError: ABCMeta  
```

### Error logs

na

### Did Dynamo succeed?

- [ ] Does dynamo.optimize("eager") succeed?

### Did AOT succeed?

- [ ] Did dynamo.optimize("aot_eager") succeed?

### Did Inductor succeed?

- [ ] Does dynamo.optimize("inductor") succeed?

### Minified repro

na

cc @soumith @msaroufim @wconstab @ngimel @bdhirsh
index_select() applied in sparse tensor can't backprop
Labels: module: sparse, triaged

### 🐛 Describe the bug

index_select() applied in sparse tensor can't backprop.

As the example below demostrates:
```
import torch

i = torch.tensor([[0, 1]])
v = torch.tensor([2., 2.], requires_grad=True)
s = torch.sparse_coo_tensor(i, v, size=[4], requires_grad=True)

print(s)
idx = torch.tensor([1, 2])
r = torch.index_select(s, 0, idx.detach()).to_dense()
print(r)
a = torch.sum(r)
a.backward()
print(v.grad)
```

When executed, it occurs an error:
```
Traceback (most recent call last):
  File "/home/xiahongchi/test/test.py", line 12, in <module>
    a.backward()
  File "/home/xiahongchi/anaconda3/envs/mininet/lib/python3.8/site-packages/torch/_tensor.py", line 396, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
  File "/home/xiahongchi/anaconda3/envs/mininet/lib/python3.8/site-packages/torch/autograd/__init__.py", line 173, in backward
    Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
RuntimeError: Tensors of type SparseTensorImpl do not have strides
```

### Versions

PyTorch version: 1.12.1+cu102
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.4 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: Could not collect
CMake version: version 3.16.3
Libc version: glibc-2.31

Python version: 3.8.13 (default, Mar 28 2022, 11:38:47)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.15.0-48-generic-x86_64-with-glibc2.17
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] torch==1.12.1
[conda] torch                     1.12.1                   pypi_0    pypi

cc @nikitaved @pearu @cpuhrsch @amjames @bhosmer
[be] Change the structure of BackendConfig so that we don't need to write helper functions
Labels: oncall: quantization, triaged

### 🐛 Describe the bug

we probably want to change how the backend configs are stored so that we don't need to write these helper functions: https://github.com/pytorch/pytorch/blob/master/torch/ao/quantization/backend_config/utils.py#L24

e.g. changing it from a list to a dictionary

### Versions

master

cc @jianyuh @raghuramank100 @jamesr66a @vkuzo
`lower_cholesky` constraint incorrectly fails on MPS
Labels: triaged, module: mps

### 🐛 Describe the bug

```python
import torch
from torch.distributions.constraints import lower_cholesky

x = torch.tensor([[1.4142]])
print("CPU:", lower_cholesky.check(x).item())
print("MPS:", lower_cholesky.check(x.to("mps")).item())
```
Outputs
```
CPU: True
MPS: False
```

### Versions

PyTorch version: 1.14.0.dev20221020
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.4 (arm64)
GCC version: Could not collect
Clang version: 14.0.0 (clang-1400.0.29.201)
CMake version: Could not collect
Libc version: N/A

Python version: 3.8.13 (default, Mar 28 2022, 06:13:39)  [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-12.4-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.4
[pip3] torch==1.14.0.dev20221020
[pip3] torchaudio==0.14.0.dev20221020
[pip3] torchcde==0.2.5
[pip3] torchdiffeq==0.2.3
[pip3] torchsde==0.2.5
[pip3] torchvision==0.15.0.dev20221020
[conda] numpy                     1.23.4                   pypi_0    pypi
[conda] torch                     1.14.0.dev20221020          pypi_0    pypi
[conda] torchaudio                0.14.0.dev20221020          pypi_0    pypi
[conda] torchcde                  0.2.5                    pypi_0    pypi
[conda] torchdiffeq               0.2.3                    pypi_0    pypi
[conda] torchsde                  0.2.5                    pypi_0    pypi
[conda] torchvision               0.15.0.dev20221020          pypi_0    pypi


cc @kulinseth @albanD @malfet @DenisVieriu97 @razarmehr @abhudev
[Bug]: TorchInductor Input As_Strided Calls Dont Compose With Offset Inputs
Labels: triaged, bug, oncall: pt2

### 🐛 Describe the bug

Torchinductor will compile some operators like `aten.select.int` to `as_strided` calls which have the signature:

`as_strided(Tensor(a) self, SymInt[] size, SymInt[] stride, SymInt? storage_offset=None) -> Tensor(a)`

When the input has a non-zero storage offset that offset is ignored. 


### Error logs

...

### Did Dynamo succeed?

- [X] Does dynamo.optimize("eager") succeed?

### Did AOT succeed?

- [X] Did dynamo.optimize("aot_eager") succeed?

### Did Inductor succeed?

- [ ] Does dynamo.optimize("inductor") succeed?

### Minified repro

```
import torch


def foo(x):
    return torch.ops.aten.select.int(x, 1, 2)

foo_opt = torch._dynamo.optimize("inductor")(foo)

y = torch.rand([3, 4, 5, 6])
z = y[2]

out_opt = foo_opt(z)
out_eager = foo(z)
print(out_opt.storage_offset() == out_eager.storage_offset())  
print(torch.allclose(out_opt, out_eager))
```
> False
False

cc @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh
Quantized Inference on GPU summary of resources
Labels: oncall: quantization, triaged

### 🚀 The feature, motivation and pitch

Quantized Inference on GPU

### Additional context

Quantization support for GPU inference is an area of active development with two existing protypes

1) PyTorch quantization + fx2trt lowering, inference in TensorRT. 

You can read more about TRT at https://pytorch.org/TensorRT/#getting-started

A PTQ tutorial using TRT can be found at https://pytorch.org/TensorRT/tutorials/ptq.html#ptq

You can also find examples in https://github.com/pytorch/TensorRT/blob/master/py/torch_tensorrt/fx/test/quant/test_quant_trt.py

2) Integration with cudnn through native quantized cuda ops which is an early prototype that's been paused.
See test_qconv2d_cudnn at https://github.com/pytorch/pytorch/blob/master/test/quantization/core/test_quantized_op.py#L4608

cc @jerryzh168 @jianyuh @raghuramank100 @jamesr66a @vkuzo @jgong5 @Xia-Weiwen @leslie-fang-intel
`chunk` a 0-dim tensor will crash in JIT script w/o profiling executor
Labels: oncall: jit

### 🐛 Describe the bug

`chunk` a 0-dim tensor will crash in JIT script w/o profiling executor

```py
import torch

class M(torch.nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, inp):
        fn_res = torch.chunk(inp, 1, dim=0)[0]
        return fn_res

fn = M().to('cpu')
inp = torch.rand([], dtype=torch.float32, device='cpu')


torch._C._jit_set_profiling_executor(False)
jit_fn = torch.jit.script(fn)
print(jit_fn.graph)
jit_fn(inp.clone())
```

```
segmentation fault (core dumped)
```

### Versions

```
Collecting environment information...
PyTorch version: 1.14.0.dev20221020
Is debug build: False
CUDA used to build PyTorch: 11.6
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Clang version: 14.0.0-1ubuntu1
CMake version: version 3.24.1
Libc version: glibc-2.35

Python version: 3.9.13 (main, Aug 25 2022, 23:26:10)  [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.19.5-051905-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 11.6.124
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3060
Nvidia driver version: 515.76
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] functorch==0.2.1
[pip3] numpy==1.23.3
[pip3] torch==1.14.0.dev20221020
[pip3] torchaudio==0.14.0.dev20221020
[pip3] torchvision==0.15.0.dev20221020
[conda] _tflow_select             2.3.0                       mkl  
[conda] blas                      1.0                         mkl  
[conda] cudatoolkit               11.3.1               h2bc3f7f_2  
[conda] functorch                 0.2.1                    pypi_0    pypi
[conda] libblas                   3.9.0            12_linux64_mkl    conda-forge
[conda] libcblas                  3.9.0            12_linux64_mkl    conda-forge
[conda] liblapack                 3.9.0            12_linux64_mkl    conda-forge
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-service               2.4.0            py39h7f8727e_0  
[conda] mkl_fft                   1.3.1            py39hd3c417c_0  
[conda] mkl_random                1.2.2            py39h51133e4_0  
[conda] numpy                     1.23.3                   pypi_0    pypi
[conda] numpy-base                1.23.1           py39ha15fc14_0  
[conda] pytorch                   1.14.0.dev20221020 py3.9_cuda11.6_cudnn8.3.2_0    pytorch-nightly
[conda] pytorch-cuda              11.6                 h867d48c_0    pytorch-nightly
[conda] pytorch-mutex             1.0                        cuda    pytorch-nightly
[conda] tensorflow-base           2.9.1           mkl_py39h353358b_0  
[conda] torchaudio                0.13.0.dev20220923+cu116          pypi_0    pypi
[conda] torchvision               0.14.0.dev20220923+cu116          pypi_0    pypi
```
Installing PyTorch with BUILD_SPLIT_CUDA=ON and CUDNN fails on linker error
Labels: module: build, module: cudnn, module: cuda, triaged, actionable

### 🐛 Describe the bug

Environment:
OS: Fedora 36, x86_64
Device: GeForce RTX 3070 Mobile
GCC: 10
Cuda: 11.6

I tried to install PyTorch with the following command:
```
(pytorch10) DEBUG=0 USE_DISTRIBUTED=0 TORCH_CUDA_ARCH_LIST="8.6" BUILD_SPLIT_CUDA=ON USE_MKLDNN=0 USE_CUDA=1 BUILD_TEST=0 USE_FBGEMM=0 USE_OPENMP=0 BUILD_CAFFE2_OPS=0 BUILD_CAFFE2=0 USE_EXPERIMENTAL_CUDNN_V8_API=0 USE_NNPACK=0 USE_QNNPACK=0 USE_NCCL=0 USE_XNNPACK=0 CMAKE_CXX_COMPILER=/home/linuxbrew/.linuxbrew/bin/g++-10 CMAKE_C_COMPILER=/home/linuxbrew/.linuxbrew/bin/gcc-10 python setup.py develop
```

the script failed on linking :

```
[2206/2210] Linking CXX executable bin/torch_shm_manager
FAILED: bin/torch_shm_manager
:
undefined reference to `at::native::cudnn_batch_norm(at::Tensor const&, at::Tensor const&, c10::optional<at::Tensor> const&, c10::optional<at::Tensor> const&, c10::optional<at::Tensor> const&, bool, double, double)'
```

I installed CUDNN and it resolved the issue. I think instead there should be an error that this library is required before trying to create the cuda shared library. The symbol it complains about is a PyTorch symbol, not a CUDNN symbol.


### Versions

torch 1.14.0a0+git440f734

cc @malfet @seemethere @csarofeen @ptrblck @xwang233 @ngimel
Document dist.new_subgroups
Labels: oncall: distributed, module: docs, triaged

### 📚 The doc issue

This is currently undocumented.

### Suggest a potential alternative/fix

_No response_

cc @mrshenli @pritamdamania87 @zhaojuanmao @satgera @gqchen @aazzolini @osalpekar @jiayisuse @H-Huang @kwen2501 @awgu @svekars @carljparker
Better type annotations for `torch.Tensor` subclasses
Labels: module: typing, triaged, actionable, tensor subclass

### 🚀 The feature, motivation and pitch

In the spirit of #86105, I think `torch.Tensor` type annotations can be improved to better support tensor subclasses.

For example, consider

```python
class Subclass(torch.Tensor):
    pass

subclass = Subclass()

reveal_type(subclass.clone())
# note: Revealed type is "torch._tensor.Tensor"

print(type(subclass.clone())
# __main__.Subclass
```

It's clear that the underlying logic preserves the subclass, but the type annotations don't. There are many methods which would benefit from improved hints: `clone`, `detach`, `new_full`, `new_ones`, `new_empty`, `new_zero`, and `new_tensor`, to name a few.

### Alternatives

_No response_

### Additional context

_No response_

cc @ezyang @malfet @rgommers @xuzhao9 @gramster
[Bug]: OPTForCausalLM failing with TORCHDYNAMO_DYNAMIC_SHAPES=1: UNPACK_SEQUENCE AssertionError: assert len(seq.items) == inst.argval
Labels: triaged, bug, oncall: pt2

### 🐛 Describe the bug

```
  File "/raid/ezyang/pytorch-scratch2/torch/_dynamo/symbolic_convert.py", line 349, in run
    and self.step()
  File "/raid/ezyang/pytorch-scratch2/torch/_dynamo/symbolic_convert.py", line 322, in step
    getattr(self, inst.opname)(inst)
  File "/raid/ezyang/pytorch-scratch2/torch/_dynamo/symbolic_convert.py", line 1000, in UNPACK_SEQUENCE
    assert len(seq.items) == inst.argval
AssertionError
```

cc @soumith @msaroufim @wconstab @ngimel @bdhirsh @voznesenskym 

### Error logs

https://gist.github.com/db994c33e9020d15e4c2ae8dbcf91d2a

### Did Dynamo succeed?

- [ ] Does dynamo.optimize("eager") succeed?

### Did AOT succeed?

- [ ] Did dynamo.optimize("aot_eager") succeed?

### Did Inductor succeed?

- [ ] Does dynamo.optimize("inductor") succeed?

### Minified repro

```
TORCHDYNAMO_DYNAMIC_SHAPES=1 AOT_DYNAMIC_SHAPES=0 time python benchmarks/dynamo/huggingface.py  --accuracy --backend eager --training --only OPTForCausalLM
```

minifier did not work (minifier ran, but resulting program did not actually fail)
[Bug]: speech_transformer failing with TORCHDYNAMO_DYNAMIC_SHAPES=1: RuntimeError: expand(CUDABoolType{[10, 1, 204, 320]}, size=[-1, 204, -1]): the number of sizes provided (3) must be greater or equal to the number of dimensions in the tensor (4)
Labels: triaged, bug, oncall: pt2

### 🐛 Describe the bug

```
RuntimeError: expand(CUDABoolType{[10, 1, 204, 320]}, size=[-1, 204, -1]): the number of sizes provided (3) must be greater or equal to the number of dimensions in the tensor (4)
```

Cannot minify as the exception occurs outside of dynamo compiled code

### Error logs

https://gist.github.com/110f0d3706cee14947dd8c4eed9a4c72

### Did Dynamo succeed?

- [ ] Does dynamo.optimize("eager") succeed?

### Did AOT succeed?

- [ ] Did dynamo.optimize("aot_eager") succeed?

### Did Inductor succeed?

- [ ] Does dynamo.optimize("inductor") succeed?

### Minified repro

```
TORCHDYNAMO_DYNAMIC_SHAPES=1 python benchmarks/dynamo/torchbench.py  --accuracy --backend eager --training --only speech_transformer
```

minifier doesn't work on this example

cc @soumith @msaroufim @wconstab @ngimel @bdhirsh
Implementation of CG, and BICGSTAB methods
Labels: module: optimizer, triaged, needs research

### 🚀 The feature, motivation, and pitch

I want to contribute to the PyTorch community with my implementation of CG and BICGSTAB methods; I believe this will immensely help research students who work in optimization theory, as they can just use these modules which have GPU support, and who have their training scripts written in PyTorch, instead of implementing them from scratch every time.

Thanks, and regards.

### Alternatives

_No response_

### Additional context

Krylov subspace methods are crucial in conjugate gradient solvers, and are a significant part of the optimization theory. Any update rule can be formulated as Ax = b; solving this system of equations iteratively with GPU support is crucial to many research students; this is especially true when they just want to approximate the solutions; an example of such a use case is the implementation of second order methods, especially newton descent methods. In deep learning, it is not feasible to completely solve the equation, hence an iterative solver is necessary. 

cc @vincentqb @jbschlosser @albanD
test_ao_sparsity fails when build without FBGEMM
Labels: triaged

### 🐛 Describe the bug

All tests from https://github.com/pytorch/pytorch/blob/master/test/ao/sparsity/test_composability.py (imported in `test_ao_sparsity`) fail when PyTorch is build without FBGEMM, e.g. on POWER.

The test suite/cases should have a `skipIfNoFBGEMM` decorator

### Versions

1.12, 1.13 and current master
[Inductor] Task Tracker for CPU Backend Optimization
Labels: triaged, oncall: pt2, module: cpu inductor

This issue summarizes all the completed, WIP and planned tasks about (or related to) TorchInductor CPU backend optimization. Note that the list is not fixed and would grow per benchmark result and feedbacks from maintainers and the community.

### Completed

- [x] https://github.com/pytorch/torchdynamo/pull/1452
- [x] https://github.com/pytorch/torchdynamo/pull/1468
- [x] https://github.com/pytorch/torchdynamo/pull/1486, https://github.com/pytorch/pytorch/pull/87037

### WIP
- [x] https://github.com/pytorch/pytorch/issues/93552 (FP32 data type as first stage)
  - [x] https://github.com/pytorch/pytorch/pull/87068
  - [x] https://github.com/pytorch/pytorch/pull/87356
  - [x] https://github.com/pytorch/pytorch/pull/88160
  - [x] https://github.com/pytorch/pytorch/pull/88482
  - [x] https://github.com/pytorch/pytorch/pull/88736
- [x] https://github.com/pytorch/pytorch/issues/93522
- [x] Conv/Linear post-op fusion for inference
  - [x] https://github.com/pytorch/pytorch/pull/87063
  - [x] https://github.com/pytorch/pytorch/pull/87064
  - [x] https://github.com/pytorch/pytorch/pull/87065
  - [x] https://github.com/pytorch/pytorch/pull/87066
- [x] Conv/Linear weight prepack for inference

### Planned (short-term)

- [x] Explicit vectorization support for BF16 data type
- [x] Explicit vectorization support for INT8 data type

### Planned (longer than short-term)
- [ ] Codegen for conv/gemm
- [ ] Autotune
- [ ] clang/llvm integration

cc @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh
Speed of torch.istft
Labels: module: performance, triaged, module: fft

### 🐛 Describe the bug

It is well-known that the complexity of FFT is O(NlogN) with respect to the sequence length N.
The complexity of STFT given N/T windows of length T is O(N/T * Tlog(T))~O(N).
As such, STFT should be theoretically faster than FFT given large sequence length N.

It can be backed up by the test as follow:
```
import torch
import time
device = torch.device('cuda')
length = 10000
hidden = 6
batch = 256
signal = torch.tensor([[[i for i in range(length)] for dim in range(hidden)] for b in range(batch)], device=device).float()
time_ls = []
for i in range(100):
    torch.cuda.synchronize()
    start = time.time()
    spec = torch.fft.rfft(signal)
    # torch.fft.irfft(spec)
    torch.cuda.synchronize()
    end  = time.time()
    time_ls.append(end - start)
time_ls = torch.tensor(time_ls)
time_ls = time_ls.sort()[0]
time_ls = time_ls[5:-5]
print(time_ls.mean(), time_ls.std())

time_ls = []
signal = signal.reshape(-1, length)
n_fft = 256
for i in range(100):
    torch.cuda.synchronize()
    start = time.time()
    spec = torch.stft(signal, n_fft=n_fft, hop_length=n_fft, center=False, onesided=True)
    # torch.istft(spec, n_fft=n_fft, hop_length=n_fft, center=False, onesided=True)
    torch.cuda.synchronize()
    end  = time.time()
    time_ls.append(end - start)
time_ls = torch.tensor(time_ls)
time_ls = time_ls.sort()[0]
time_ls = time_ls[5:-5]
print(time_ls.mean(), time_ls.std())
```
where the time of fft is 0.0008, and the time of stft is 0.0005. That is great!

However, if you uncomment the istft lines, the results are strange,
where the time of fft + ifft is 0.0019, and the time of stft + istft is 0.003.

Why does istft consume so much time?

### Versions

pytorch nightly-release.
**In pytorch 1.12.1 (stable version), the istft function behaves even more poorly due to #84407**

cc @VitalyFedyunin @ngimel @mruberry @peterbell10
RuntimeError: Tensors of type TensorImpl do not have numel
Labels: module: build, module: cuda, triaged, module: docker

### 📚 The doc issue

I was trying to build a docker with pytorch versions as follows

RUN pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113

and             nvidia/cuda:11.0-base

and found the error log as follows

![image](https://user-images.githubusercontent.com/60175495/196897456-41f67c47-2d6a-418d-b0eb-2acfe9044b6c.png)

### Suggest a potential alternative/fix

_No response_

cc @malfet @seemethere @ngimel
buffer is not large enough when running pytorch on M1 mps
Labels: triaged, module: mps

### 🐛 Describe the bug

(update: look at next comments for easier reproductions)

As #78496 fix I thought I can use mps using nightly version of torch so when using `torch-1.14.0.dev20221019` I ran 

```bash
# preparations
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
pip3 install git+https://github.com/openai/whisper.git # OpenAI's whisper project
wget https://cdn-media.huggingface.co/speech_samples/sample2.flac # just a sample audio file

# actual run
whisper sample2.flac --language=en --device=mps
```

I got, `Error: buffer is not large enough. Must be 29000 bytes`,

```bash
/opt/homebrew/lib/python3.10/site-packages/whisper/decoding.py:629: UserWarning: The operator 'aten::repeat_interleave.self_int' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/mps/MPSFallback.mm:11.)
  audio_features = audio_features.repeat_interleave(self.n_group, dim=0)
/AppleInternal/Library/BuildRoots/a0876c02-1788-11ed-b9c4-96898e02b808/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:782: failed assertion `[MPSNDArray, initWithBuffer:descriptor:] Error: buffer is not large enough. Must be 29000 bytes
'
[1]    32842 abort      whisper sample2.flac --device=mps --language=en
/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
```

Just to note, I don't have the issue with the code https://github.com/pytorch/pytorch/issues/78247 so possibly this is a different issue.

### Versions

```bash
Collecting environment information...
PyTorch version: 1.14.0.dev20221019
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.6 (arm64)
GCC version: Could not collect
Clang version: 14.0.0 (clang-1400.0.29.102)
CMake version: version 3.24.2
Libc version: N/A

Python version: 3.10.8 (main, Oct 13 2022, 09:48:40) [Clang 14.0.0 (clang-1400.0.29.102)] (64-bit runtime)
Python platform: macOS-12.6-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.4
[pip3] torch==1.14.0.dev20221019
[pip3] torchaudio==0.13.0.dev20221019
[pip3] torchvision==0.15.0.dev20221019
[conda] Could not collect
```

cc @kulinseth @albanD @malfet @DenisVieriu97 @razarmehr @abhudev
OpenCL 3.0 support: support every GPU on earth through rusticl
Labels: feature, triaged

### 🚀 The feature, motivation and pitch

I know openCL has been requested quite a few times in the past, and it would be a fairly sizable effort to port all of the hundreds of small primitives required. Usually the complaints seem to break down into spotty support and bad performance.

However, with the rapid development of rusticl I think the landscape has changed significantly.

Rusticl is a translation layer in Mesa written in rust, in much the same vein as zink. It provides openCL support on top of gallium 3D, implementing OpenCL 3.0. It was merged into Mesa in mid September and has developed extremely rapidly. It's already useful for running 3D renders in luxmark, GIMP, darktable, with OpenCL image support unlike Clover. It also reportedly passes the OpenCL 3.0 conformance tests.

In terms of hardware support,
It's been fixed up for dGPU support: https://www.phoronix.com/news/Rusticl-Discrete-GPU-Fixes
It's being ported to RadeonSI: https://www.phoronix.com/news/Rusticl-RadeonSI-WIP 
to Intel Iris: https://www.phoronix.com/news/Intel-Iris-Rusticl-Prep
and can even run on top of Vulcan drivers, for example intel's ANV: https://www.phoronix.com/news/Rusticl-Zink-Vulkan-Works

It's looking like this is a great way to get PyTorch running _**everywhere.**_
Both major vendors' open drivers, RdeonSI and Iris, but also to the plethora of Vulcan drivers as well.

It can also now outperform ROCm in some cases, and will probably continue to get faster with ongoing optimization work: https://www.phoronix.com/news/Rusticl-Outperformed-ROCm

### Alternatives

There is work on AMD ROCm and partial Vulkan support, but with rusticl already running on ANV through zink, you'd get full support on both AMD and all Vulcan drivers with the same API, with full-featured support on the latter basically for free.

As I understand it, spotty support for ROCm across AMD cards has been a major hurdle (there are plenty of people out there trying to hack PyTorch/ROCm to run on an RX 580, for example), but rusticl already runs equally well on all of them: https://twitter.com/illwieckz/status/1582803118093635585

### Additional context

_No response_
Tracker for manually running pytorch/examples 
Labels: triaged, oncall: pt2

- [x] imagenet
  - https://github.com/pytorch/torchdynamo/issues/1687 and https://github.com/pytorch/torchdynamo/issues/1701 were filed and fixed.
- [x] word_language_model
  - https://github.com/pytorch/torchdynamo/issues/1712 was filed and fixed
- [ ] time_sequence_prediction
  - https://github.com/pytorch/pytorch/issues/93558 was filed 
- [ ] fast_neural_style
- [ ] mnist
- [ ] mnist_hogwild
- [ ] regression
- [ ] reinforcement_learning
- [ ] siamese_network
- [ ] super_resolution
- [ ] vae
- [ ] dcgan

cc @ezyang @msaroufim @wconstab @ngimel @bdhirsh
Better error message when attempting to `torch.save` an optimized model
Labels: triaged, oncall: pt2

A bunch of examples directly do `torch.save(model)`. For example https://github.com/pytorch/examples/blob/main/word_language_model/main.py#L234-L235

Right now, if a dynamo-optimized model is attempted to be saved, this is the error message.
Fixing this IMO is not a priority.
But, at the very least, a better error message should be displayed.

```
-----------------------------------------------------------------------------------------
| end of epoch   1 | time: 26.86s | valid loss  7.29 | valid ppl  1467.68
-----------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/soumith/code/examples/word_language_model/main.py", line 237, in <module>
    torch.save(model, f)
  File "/home/soumith/code/pytorch/torch/serialization.py", line 422, in save
    _save(obj, opened_zipfile, pickle_module, pickle_protocol)
  File "/home/soumith/code/pytorch/torch/serialization.py", line 634, in _save
    pickler.dump(obj)
AttributeError: Can't pickle local object '_TorchDynamoContext.__call__.<locals>.TorchDynamoNNModuleWrapper'
```

cc @ezyang @msaroufim @wconstab @ngimel @bdhirsh
[Quant] There is no default_qconfig_mapping for dynamic quantization
Labels: oncall: quantization, low priority, triaged

https://github.com/pytorch/pytorch/blob/86a581928a4f5065a79771a7a2d87c6999c452e9/torch/ao/quantization/qconfig_mapping.py#L65

`get_default_qconfig_mapping` today only uses static qconfigs. Users who wish to use dynamic qconfigs will have to do something like the following (similar to https://github.com/pytorch/pytorch/pull/87002):

```
qconfig_mapping = get_default_qconfig_mapping().set_global(default_dynamic_qconfig)
for pattern in qconfig_mapping.object_type_qconfigs.keys():
    if pattern not in _FIXED_QPARAMS_OP_TO_OBSERVER:
        qconfig_mapping.set_object_type(pattern, default_dynamic_qconfig)
```

Maybe we should have `get_default_qconfig_mapping` accept a `default_qconfig` argument.

cc @jerryzh168 @jianyuh @raghuramank100 @jamesr66a @vkuzo @jgong5 @Xia-Weiwen @leslie-fang-intel
Missing string parsing for some parameter types in python arg parsing logic
Labels: high priority, triaged, module: pybind

### 🐛 Describe the bug

This bug was uncovered while working on https://github.com/pytorch/pytorch/pull/87095. We were accessing garbage value for the default symint argument while directly calling into python bindings code (`torch._C`). Unfortunately symint and symintlist weren't the only parameter types that weren't handled properly in `set_default_str`, which scans the string and sets the default value as well as throws an error if it sees something unexpected (e.g., `None` for device).
Currently, the following argument types are not handled:
```
ParameterType::TENSOR_LIST
ParameterType::GENERATOR
ParameterType::PYOBJECT
ParameterType::MEMORY_FORMAT
ParameterType::DIMNAME
ParameterType::DIMNAME_LIST
ParameterType::SCALAR_LIST
ParameterType::STORAGE
ParameterType::QSCHEME
 ``` 
This was only discovered with the above PR because before, we weren't throwing error by default if a parameter type wasn't handled. 
Granted that most of them probably don't need to store anything in the default case because they usually default to empty containers, but we should have a hard check for this in `set_default_str`. (added a fallthrough for now: https://github.com/pytorch/pytorch/pull/87095/files#diff-bb8fc823d2ddc10e38cabfc113c4aa0682b6082089079209abab27b7715d1e3eR1062-R1086)

### Versions

Master

cc @ezyang @gchanan @zou3519
Enable TorchInductor to support more vectorization operators
Labels: triaged, oncall: pt2, module: cpu inductor

### 🚀 The feature, motivation and pitch

Currently, we are working on the TorchInductor optimization by using `aten::vec` to accelerate the operator performance. 

Regarding the mathematic functions like `exp`, `tanh` and etc, TorchInductor runs into C++ std function now. Its performance is much worse than `aten::vec` because `aten::vec` leverages `Sleef` functions.

We have submitted a PR to establish the infrastructure - https://github.com/pytorch/pytorch/pull/87068. Besides that, we need to implement more features as follows.

- [x] Support reduction
- [ ] Vectorize the tail loop with `aten::vec`
- [x] Lower `angle`, `acos`, `asin`, `atan`, `atan2`, `erfc`, `erfinv`, `expm1`, `log10`, `frac`, `sinh`, `cosh`, `hypot`, `igamma`, `igammac`, `nextafter`, `tan`
- [ ] `round`, `log2`, `log1p`: couldn't find symbolic meta function/decomposition
- [x] Support BF16
- [ ] Optimize the loop condition and loop index calculation by replacing `div` with `add`

### Alternatives

To use OMP SIMD to vectorize the kernel. But it is hard to force the SIMD to run into the `Sleef` function to get better performance.

### Additional context

N/A

cc @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh @jansel @lezcano @fdrocha
[Bug]: GoogleFnet failed to load with amp
Labels: triaged, bug, oncall: pt2

### 🐛 Describe the bug

Command that fails:
```bash
python benchmarks/huggingface.py --performance --training -d cuda --backend=aot_eager --skip-accuracy-check --only GoogleFnet --amp
```


### Error logs

```py
  File "/opt/conda/lib/python3.8/site-packages/transformers/models/fnet/modeling_fnet.py", line 220, in forward
    self_outputs = self.self(hidden_states)
  File "/opt/pytorch/pytorch/torch/nn/modules/module.py", line 1190, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/transformers/models/fnet/modeling_fnet.py", line 199, in forward
    outputs = self.fourier_transform(hidden_states).real
RuntimeError: cuFFT only supports dimensions whose sizes are powers of two when computing in half precision, but got a signal size of[512, 768]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/pytorch/torchdynamo/benchmarks/common.py", line 1881, in main
    device, name, model, example_inputs, batch_size = runner.load_model(
  File "benchmarks/huggingface.py", line 402, in load_model
    self.validate_model(model, example_inputs)
  File "/opt/pytorch/torchdynamo/benchmarks/common.py", line 1009, in validate_model
    raise NotImplementedError("Eager model failed to run")
NotImplementedError: Eager model failed to run

WARNING:root:GoogleFnet failed to load
```

### Did Dynamo succeed?

- [ ] Does dynamo.optimize("eager") succeed?

### Did AOT succeed?

- [ ] Did dynamo.optimize("aot_eager") succeed?

### Did Inductor succeed?

- [ ] Does dynamo.optimize("inductor") succeed?

### Minified repro

.

cc @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh
torch.save throws ValueError: ctypes objects containing pointers cannot be pickled
Labels: module: serialization, triaged

### 🐛 Describe the bug

I have tried saving my dataloader object, but it throws me ValueError: ctypes objects containing pointers cannot be pickled
Here is the code:
```
batch_size = 16

do_flip = True
flip_vert = True 
max_rotate = 90 
max_zoom = 1.1 
max_lighting = 0.2
max_warp = 0.2
p_affine = 0.75 
p_lighting = 0.75 

tfms = get_transforms(do_flip=do_flip,
                      flip_vert=flip_vert,
                      max_rotate=max_rotate,
                      max_zoom=max_zoom,
                      max_lighting=max_lighting,
                      max_warp=max_warp,
                      p_affine=p_affine,
                      p_lighting=p_lighting)
train, valid,test = ObjectItemListSlide(train_images) ,ObjectItemListSlide(valid_images),ObjectItemListSlide(test_images)
item_list = ItemLists(".", valid, test)
lls = item_list.label_from_func(lambda x: x.y, label_cls=SlideObjectCategoryList)
lls = lls.transform(tfms, tfm_y=True, size=patch_size)
data_test= lls.databunch(bs=batch_size, collate_fn=bb_pad_collate,num_workers=0).normalize()
torch.save(data_test.valid_dl,"test_dl.pt")
```
ValueError                                Traceback (most recent call last)
[<ipython-input-18-91b8a8dc1f71>](https://localhost:8080/#) in <module>
----> 1 torch.save(data_test.valid_dl,"test_dl.pt")

1 frames
[/usr/local/lib/python3.7/dist-packages/torch/serialization.py](https://localhost:8080/#) in save(obj, f, pickle_module, pickle_protocol, _use_new_zipfile_serialization)
    378         if _use_new_zipfile_serialization:
    379             with _open_zipfile_writer(opened_file) as opened_zipfile:
--> 380                 _save(obj, opened_zipfile, pickle_module, pickle_protocol)
    381                 return
    382         _legacy_save(obj, opened_file, pickle_module, pickle_protocol)

[/usr/local/lib/python3.7/dist-packages/torch/serialization.py](https://localhost:8080/#) in _save(obj, zip_file, pickle_module, pickle_protocol)
    587     pickler = pickle_module.Pickler(data_buf, protocol=pickle_protocol)
    588     pickler.persistent_id = persistent_id
--> 589     pickler.dump(obj)
    590     data_value = data_buf.getvalue()
    591     zip_file.write_record('data.pkl', data_value, len(data_value))

ValueError: ctypes objects containing pointers cannot be pickled


### Versions

torch-1.11.0 torchvision-0.12.0

cc @mruberry
Use new input clearing mechanism for aot_eager
Labels: triaged, oncall: pt2

        @Chillee 
![image](https://user-images.githubusercontent.com/13822661/195258429-54a3927b-d2a7-4f96-a146-a9e5ffcefa2e.png)

Is this optimization already enabled for `aot_eager`? The numbers seem to suggest that it's not. Should we try to enable it with `aot_eager` first just as a confirmation that nothing new has creeped into the memory footprint?

_Originally posted by @anijain2305 in https://github.com/pytorch/torchdynamo/issues/1600#issuecomment-1275613843_
      

cc @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh
register_package has no further documentation
Labels: module: docs, oncall: package/deploy

### 📚 The doc issue

There is a page describing how to save and load torch models.  It briefly mentions 

```
User extensions can register their own location tags and tagging and deserialization methods using torch.serialization.register_package().
```

However, there is no further explanation beyond that.

https://pytorch.org/docs/stable/generated/torch.load.html?highlight=register_package


### Suggest a potential alternative/fix

If there's a convenient way to extend the capabilities of load & save, it would be useful to know more about it.  `register_package` sounds potentially useful, but there is no documentation on it, and the pydoc for that function is empty as well

https://github.com/pytorch/pytorch/blob/c413a32135b745d29e555069d7cd8f6e6527b59f/torch/serialization.py#L89

cc @svekars @carljparker
The installation commands given on the pytorch website will not install properly
Labels: oncall: binaries, triaged

Description: The command to install torch 1.10.0 on the pytorch website is
pip install torch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0
Impact: Following the commands on the official website will result in an error that prevents installation
Solution: Change the installation command to the following, and change torchvision==0.11.0 to 0.11.1
pip install torch==1.10.0 torchvision==0.11.1 torchaudio==0.10.0
<img width="844" alt="图片3" src="https://user-images.githubusercontent.com/60139005/196588665-48a49c8e-b13e-44b6-bc1a-6390a027b24b.png">
<img width="936" alt="图片4" src="https://user-images.githubusercontent.com/60139005/196588671-7ab5d603-9873-4c50-a4b7-c7e5d55f85b6.png">
![图片5](https://user-images.githubusercontent.com/60139005/196588678-e903e1e0-ec75-4c1f-84b6-bfbc09ac0fd1.png)


cc @ezyang @seemethere @malfet
nvprims.div doesn't work with FakeTensor cpu scalars
Labels: triaged, module: nvfuser, module: fakeTensor

### 🐛 Describe the bug


```py
import torch
from torch.fx.experimental.proxy_tensor import make_fx
from torch._subclasses.fake_tensor import FakeTensor

meta_scalar = torch.zeros((), device="meta")
meta_tensor = torch.zeros((3, 3), device="meta")

with torch._subclasses.fake_tensor.FakeTensorMode() as mode:
    fake_cpu_scalar = FakeTensor(mode, meta_scalar, torch.device("cpu"))
    fake_cuda_tensor = FakeTensor(mode, meta_tensor, torch.device("cuda"))

gm = make_fx(lambda a, b: torch.ops.nvprims.div(a, b))(fake_cuda_tensor, fake_cpu_scalar)
```
```py
File ~/dev/pytorch/master/torch/_prims_common/__init__.py:612, in check_same_shape(allow_cpu_scalar_tensors, *args)
    608     if not is_same_shape(shape, arg.shape):
    609         msg = "Shape {0} is not the expected shape {1}!".format(
    610             arg.shape, shape
    611         )
--> 612         raise RuntimeError(msg)
    613 else:
    614     msg = (
    615         "Unexpected type when checking for same shape, " + str(type(arg)) + "!"
    616     )

RuntimeError: Shape torch.Size([]) is not the expected shape torch.Size([3, 3])!
```
It works fine with `torch.ops.prims.div`.

### Versions

Latest master.

cc @kevinstephano @jjsjann123
Dynamo+FSDP overall triage
Labels: triaged, module: fsdp, oncall: pt2

Let me post various issues here first and then graduate some of them to their own issue rather than opening tons of issues in the beginning, since some of these may be minor/cosmetic/easy to fix.

- [ ] FakeTensor + FlatParamsWrapper Bug  (WIP: pytorch/pytorch#93688 )
- [ ] `[WARNING] Graph break: inline in skipfiles: forward` -- triaging below
- [ ] toy_model: `RuntimeError: The size of tensor a (159567000) must match the size of tensor b (319134000) at non-singleton dimension 0` -- triaging below
- [ ]  hf_Bert/hf_T5: `NotImplementedError: UserDefinedObjectVariable(_GenericAlias) is not a constant` -- possible dupe of pytorch/pytorch#93695 ?

cc @zhaojuanmao @mrshenli @rohan-varma @awgu @ezyang @soumith @msaroufim @ngimel @bdhirsh
`custom_jvp` and `custom_vjp`
Labels: triaged, module: functorch

### 🚀 The feature, motivation and pitch

`functorch` equivalents to [jax.custom_jvp](https://jax.readthedocs.io/en/latest/_autosummary/jax.custom_jvp.html#jax.custom_jvp) and [jax.custom_vjp](https://jax.readthedocs.io/en/latest/_autosummary/jax.custom_vjp.html#jax.custom_vjp), i.e., decorators to define custom derivatives:

#### PyTorch API

```Python
class F(Function):
    @staticmethod
    def jvp():
        pass

    @staticmethod
    def vjp():
        pass

f = F()
```

#### Hypothetical functorch API

```Python
@functorch.custom_jvp
@functorch.custom_vjp
def f(x: Tensor) -> Tensor:
    pass

@f.x_jvp
def f_x_jvp():
    pass

@f.x_vjp
def f_x_vjp():
    pass
```

### Alternatives

_No response_

### Additional context

_No response_

cc @zou3519 @Chillee @samdow @soumith
Missing `docker` directory in `tools/` 
Labels: module: docs, triaged, module: docker

### 🐛 Describe the bug

The `docker` directory mentioned in README of build `tools` is missing
https://github.com/pytorch/pytorch/blob/dbccccb7a2f724fc57e42bd1f347212f12984a67/tools/README.md?plain=1#L56

The link listing all runtime Docker images could be used here.


cc @svekars @holly1238
Unstable results in sin/arcsin/arccos calls
Labels: module: numerical-stability, triaged, module: edge cases

### 🐛 Describe the bug

I get unstable results when sin, arcsin, arccos are called sequentially. sin followed by arcsin should give by the same value, however the calculation is not exactly the same and we get unstable results after arccos: `0.0003` on CPU and `nan` on CUDA.

Here is the code to reproduce the issue:
```
import torch

x = torch.ones(2)
y = torch.sin(x)
y = torch.arcsin(y)  # inverse operations, gives [1.0000, 1.0000]
y = torch.arccos(y)
print(y) # gives [0.0003, 0.0003]

x1 = x.clone().cuda()
y1 = torch.sin(x1)
y1 = torch.arcsin(y1) # gives [1.0000, 1.0000]
y1 = torch.arccos(y1)
print(y1) # gives [nan, nan]
```

### Versions

1.12.1+cu113