gopikrsmscs/torch-issues huggingface dataset:
Add dynamo support for `autograd.Function` with multiple return values.
Labels: open source, module: dynamo, ciflow/inductor

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):
* #110417
* __->__ #107618
* #109433
* #110290

Fix: #106389

cc @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov
Previous version not found
Labels: oncall: releng, triaged

### 📚 The doc issue

I'm trying to download a specific version of pytorch (1.8.0 with CUDA 11.1) and I found this [page](https://pytorch.org/get-started/previous-versions/) where I could download it using the following command:


`pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html`

No matter what I try, I get the following error message:

> ERROR: Could not find a version that satisfies the requirement torch==1.8.0+cu111 (from versions: 2.0.0, 2.0.0+cpu, 2.0.0+cu117, 2.0.0+cu118, 2.0.1, 2.0.1+cpu, 2.0.1+cu117, 2.0.1+cu118)
> ERROR: No matching distribution found for torch==1.8.0+cu111

Could somebody tell me how to fix this issue? I'm kind of a newbie with PyTorch.

Thanks :)

### Suggest a potential alternative/fix

_No response_
[Fix] add validation logics to TCPStore queries
Labels: triaged, open source, module: c10d, release notes: distributed (c10d)

This PR fixes #106294.

Due to the lack of request validation mechanism, TCPStore in torch mistakenly treats nmap scan messages as valid query messages, which leads to DDP OOM. The simple solution enforces the very first query from a client is a validation query with a predefined magic number. If the validation fails, the server will terminate the connection.
Support AMD Ryzen Unified Memory Architecture (UMA)
Labels: module: rocm, triaged

### 🚀 The feature, motivation and pitch

**Background:**
I am using Asus Zenbook S13 OLED, which runs AMD Ryzen 6800U APU. The APU comes with 680M Graphics Card. The memory of the graphic card use the shared memory from the system and its default is 512MB (Please reference the screenshot below).
![alt text](https://p.xfastest.com/~sinchen/AMD-Zenbook-S-13-OLED/AMD-Zenbook-S-13-OLED-7.jpg)

In Windows environment the memory size would dynamically change, due to the amount of GPU memory required. But in Linux environment it shows 512MB memory (which is the result of setting Auto in BIOS) and thus when I use Stable Diffusion Pytorch would face the OOM situation. As the BIOS setting of the Notebook doesn't allow users from modifying the amount of dedicated memory so would it be possible that PyTorch could support UMA? 

Here is the quote from [AMD Ryzen UMA](https://www.amd.com/en/support/kb/faq/pa-280#faq-Recommendations)

> The UMA Frame Buffer Size when set to Auto (default setting) allows the system to manage the amount of shared memory for graphics. In this configuration, the size of the UMA frame buffer should scale depending on the amount of available system memory, enabling the system to perform in an optimal state. Therefore, it is recommended to leave the setting on Auto, which is ideal for most types of video processing workloads.

### Alternatives

_No response_

### Additional context

Another developer created [torch-apu-helper](https://github.com/pomoke/torch-apu-helper) that uses `CUDAPluggableAllocator` to take advantage of the shared memory on PyTorch. However when I try the code snippet with Stable Diffusion I got the following error:

```
RuntimeError: CUDAPluggableAllocator does not yet support getDeviceStats. If you need it, please file an issue describing your use case.
```

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @dllehr-amd @jataylo @hongxiayang
torch._dynamo.exc.Unsupported: call_method UserDefinedObjectVariable(defaultdict) items [] {}
Labels: good first issue, triaged, oncall: pt2, module: dynamo

### 🐛 Describe the bug

occurs in torchrec FusedEmbeddingBagCollection

### Versions

main

cc @msaroufim @wconstab @bdhirsh @anijain2305 @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov
dynamo: don't graph break on ctx.mark_dirty
Labels: triaged, module: dynamo

### 🐛 Describe the bug

Can we add dynamo support for `torch.autograd.Function::ctx.mark_dirty` without a graph break? It currently graph breaks.

Repro: https://gist.github.com/vkuzo/210b2fdf0e0f14cc01e3b6af6a4c176e
Logs: https://gist.github.com/vkuzo/171e765c492ae5175c558409892c5181

This will be needed for `Float8` training UX.

### Versions

master

cc @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov
Select on a coalesced COO tensor returns COO tensor with coalesce flag set to False.
Labels: module: sparse, feature, triaged

## Issue description

As in the title. The result of `select` ought to be always coalesced when its input tensor is a coalesced COO tensor because the ordering of indices in the select result is the same as in the input tensor indices.

## Code example

```python
>>> a = torch.tensor([[0, 1, 2], [3, 4, 5], [5, 6, 7]]).to_sparse()
>>> a.is_coalesced()
True
>>> a.select(0, 0)
tensor(indices=tensor([[1, 2]]),
       values=tensor([1, 2]),
       size=(3,), nnz=2, layout=torch.sparse_coo)
>>> a.select(0, 0).is_coalesced()
False
```

The expected result is `True`.

## System Info

- PyTorch version: main

cc @alexsamardzic @nikitaved @cpuhrsch @amjames @bhosmer
Add support for float8_e4m3fnuz and _e5m2fnuz
Labels: module: cpu, triaged, open source, NNC, release notes: quantization, release notes: linalg_frontend, skip-pr-sanity-checks

This PR relates to the feature in [this feature submission](https://docs.google.com/document/d/1pF2T1xz54IPg1jG7FhykbrpbcJZVelQw0v8vBaoLkfs/edit). It has been based on #104242 which adds similar float8 types.

These new types added in this PR are described in the paper at https://arxiv.org/abs/2206.02915. A brief description and comparison of the types with other float8 types can be also found in the [OpenXLA RFC](https://github.com/openxla/stablehlo/blob/main/rfcs/20230321-fp8_fnuz.md).

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @EikanWang @albanD
Enable Mypy Checking in torch/_inductor/triton_heuristics.py
Labels: triaged, open source, Stale, module: inductor, ciflow/inductor

Fixes #105230

Summary:

As suggested in https://github.com/pytorch/pytorch/issues/105230 mypy checking is enabled in torch/_inductor/triton_heuristics.py

After Fix:

mypy --follow-imports=skip torch/_inductor/triton_heuristics.py Success: no issues found in 1 source file

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov @ColinPeppler @Xia-Weiwen @ngimel
[FakeTensor] `to` doesn't error with `allow_non_fake_inputs=False`
Labels: triaged, module: fakeTensor

### 🐛 Describe the bug

```python
import torch
from torch._subclasses.fake_tensor import FakeTensorMode

number = 0.5
const = torch.tensor(number)

with FakeTensorMode(allow_non_fake_inputs=False):
    x = const.sin()  # Fails as expected `Please convert all Tensors to FakeTensors first or instantiate FakeTensorMode with 'allow_non_fake_inputs'.`

    x = const.to(torch.float)  # This passes
    print(x)  # tensor(0.5)
    x = const.to(torch.int)  # This passes
    print(x)  # FakeTensor(..., size=(), dtype=torch.int32)
```

cc: @zou3519 

### Versions

main
[LibTorch/iOS] Building with METAL support script is freezing
Labels: triaged, oncall: mobile, module: ios

### 🐛 Describe the bug

I am trying to build the library to support METAL on iOS, I am executing this command after cloning the repo:

`IOS_ARCH=arm64 USE_PYTORCH_METAL=1 ./scripts/build_ios.sh`

However, it just freezes here at 86%:

```
Consolidate compiler generated dependencies of target torch_cpu
[ 86%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/aten/src/ATen/native/cpu/ReduceOpsKernel.cpp.DEFAULT.cpp.o
```

### Versions

LibTorch-Lite (1.13.0.1):
LibTorch-Lite/Core (= 1.13.0.1)
LibTorch-Lite/Core (1.13.0.1):
LibTorch-Lite/Torch
LibTorch-Lite/Torch (1.13.0.1)

cc @kulinseth @albanD @malfet @DenisVieriu97 @razarmehr @abhudev
Doc is unclear on how to install pytorch with Cuda via pip
Labels: triaged, topic: docs

### 📚 The doc issue

![image](https://github.com/pytorch/pytorch/assets/35759490/17b506aa-ff3a-40cf-baac-63bb66c486ac)

I've been looking on how to install torch with CUDA via pip for almost one day and the doc is absolutely not helping on how to do so.

### Suggest a potential alternative/fix

Explain clearly how to install pytorch using pip with CUDA or not.

```
To install pytorch with CUDA using pip, you first need to install CUDA on your system if it is compatible with it and then install pytorch with the following command in your shell:

`pip install ...........`
```
caching keys+values in TransformerDecoderLayer for faster inference
Labels: triaged, oncall: transformer/mha

### 🚀 The feature, motivation and pitch

In autoregressive generation, at step k, we only need to compute the new token k+1, based on all the previous ones. 
This can be done in $O(k  d)$ for each step, if we cache previous examples.
However, the current nn.TransformerDecoderLayer (and Encoder) does not support this.
Therefore, currently the most efficient inference method would be  in $O(k^2  d)$ for each step.



### Alternatives

add an option to feed in previously calculated keys+values, and if they appear, avoid some unneeded computations.

### Additional context

_No response_

cc @jbschlosser @bhosmer @cpuhrsch @erichan1 @drisspg
Hacked up SHAPE_ENV provenance
Labels: release notes: fx, module: dynamo, ciflow/inductor

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):
* __->__ #107567
* #107439
* #107471
* #107562
* #107532
* #107530
* #107516
* #107505

Signed-off-by: Edward Z. Yang <ezyang@meta.com>

cc @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @aakhundov
Dynamo guards on unused Tensor variables
Labels: triaged, oncall: pt2, module: dynamo

### 🐛 Describe the bug

```
import torch

@torch.compile(backend="eager")
def f(x, y):
    return x * 2

f(torch.randn(2), torch.randn(3))
```

Produces these guards:

```
(/home/ezyang/local/b/pytorch-env) [ezyang@devgpu005.nha1 ~/local/b/pytorch (fe888068)]$ TORCH_LOGS=guards python n.py
[2023-08-20 17:50:05,934] [0/0] torch._dynamo.guards.__guards: [DEBUG] GUARDS:
[2023-08-20 17:50:05,934] [0/0] torch._dynamo.guards.__guards: [DEBUG] hasattr(L['x'], '_dynamo_dynamic_indices') == False           # _dynamo/variables/builder.py:1237 in wrap_fx_proxy_cls
[2023-08-20 17:50:05,935] [0/0] torch._dynamo.guards.__guards: [DEBUG] hasattr(L['y'], '_dynamo_dynamic_indices') == False           # _dynamo/variables/builder.py:1237 in wrap_fx_proxy_cls
[2023-08-20 17:50:05,935] [0/0] torch._dynamo.guards.__guards: [DEBUG] ___is_grad_enabled()                                          # _dynamo/output_graph.py:345 in init_ambient_guards
[2023-08-20 17:50:05,935] [0/0] torch._dynamo.guards.__guards: [DEBUG] not ___are_deterministic_algorithms_enabled()                 # _dynamo/output_graph.py:341 in init_ambient_guards
[2023-08-20 17:50:05,935] [0/0] torch._dynamo.guards.__guards: [DEBUG] ___is_torch_function_enabled()                                # _dynamo/output_graph.py:349 in init_ambient_guards
[2023-08-20 17:50:05,935] [0/0] torch._dynamo.guards.__guards: [DEBUG] utils_device.CURRENT_DEVICE == None                           # _dynamo/output_graph.py:347 in init_ambient_guards
[2023-08-20 17:50:05,935] [0/0] torch._dynamo.guards.__guards: [DEBUG] check_tensor(L['x'], Tensor, DispatchKeySet(CPU, BackendSelect, ADInplaceOrView, AutogradCPU), torch.float32, device=None, requires_grad=False, size=[2], stride=[1])  # _dynamo/variables/builder.py:1237 in wrap_fx_proxy_cls
[2023-08-20 17:50:05,935] [0/0] torch._dynamo.guards.__guards: [DEBUG] check_tensor(L['y'], Tensor, DispatchKeySet(CPU, BackendSelect, ADInplaceOrView, AutogradCPU), torch.float32, device=None, requires_grad=False, size=[3], stride=[1])  # _dynamo/variables/builder.py:1237 in wrap_fx_proxy_cls
```

Guarding on y is unnecessary because it is unused. In fact, we know to prune it from the graph we compile, but we don't know to avoid doing guard tests on it.

### Versions

main

cc @msaroufim @wconstab @bdhirsh @anijain2305 @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov
Integer multiplication overflow when running torch.nn.AdaptiveAvgPool2d
Labels: triaged, module: int overflow

### 🐛 Describe the bug

Due to arg_1 = 1250999900000

```
import torch
import numpy as np
arg_1 = 1250999900000
arg_class = torch.nn.AdaptiveAvgPool2d(arg_1,)
arg_2_0_tensor = torch.rand([80, 128, 16, 16], dtype=torch.float32)
arg_2_0 = arg_2_0_tensor.clone()
arg_2 = [arg_2_0,]
try:
  res = arg_class(*arg_2)
except Exception as e:
  print("Error:"+str(e))
```

### Versions

```
PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch
```
Integer multiplication overflow when running torch.nn.MaxUnpool3d
Labels: triaged, module: int overflow

### 🐛 Describe the bug

Due to arg_1 = -23287

```
import torch
import numpy as np
arg_1 = -23287
arg_2 = 2
arg_class = torch.nn.MaxUnpool3d(arg_1,stride=arg_2,)
arg_3_0_tensor = torch.rand([20, 16, 25, 16, 7], dtype=torch.float32)
arg_3_0 = arg_3_0_tensor.clone()
arg_3_1_tensor = torch.randint(-1024,8,[20, 16, 25, 16, 7], dtype=torch.int64)
arg_3_1 = arg_3_1_tensor.clone()
arg_3 = [arg_3_0,arg_3_1,]
try:
  res = arg_class(*arg_3)
except Exception as e:
  print("Error:"+str(e))
```

### Versions

PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch
Integer multiplication overflow when running torch.diagflat
Labels: triaged, module: int overflow

### 🐛 Describe the bug

Due to arg_2 = 1250999896764

```
import torch
import numpy as np
arg_1_tensor = -torch.rand([3], dtype=torch.float64)
arg_1 = arg_1_tensor.clone()
arg_2 = 1250999896764
try:
  res = torch.diagflat(arg_1,arg_2,)
except Exception as e:
  print("Error:"+str(e))
```

### Versions

```
PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch
```
Storage size calculation overflowed when torch.nn.Upsample
Labels: triaged, module: int overflow

### 🐛 Describe the bug

Due to arg_1 = 1250999896765

```
import torch
import numpy as np
arg_1 = 1250999896765
arg_2 = "bilinear"
arg_3 = False
arg_class = torch.nn.Upsample(scale_factor=arg_1,mode=arg_2,align_corners=arg_3,)
arg_4_0_tensor = torch.rand([5, 3, 64, 64], dtype=torch.float32)
arg_4_0 = arg_4_0_tensor.clone()
arg_4 = [arg_4_0,]
try:
  res = arg_class(*arg_4)
except Exception as e:
  print("Error:"+str(e))
```

### Versions

```
PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch
```
Storage size calculation overflowed when running torch.nn.functional.interpolate
Labels: triaged, module: int overflow

### 🐛 Describe the bug

Due to a very large integer variable.

```
import torch
import numpy as np
arg_1_tensor = torch.neg(torch.rand([1, 256, 14, 14], dtype=torch.float32))
arg_1 = arg_1_tensor.clone()
arg_2 = 1250999896765
arg_3 = "bilinear"
arg_4 = True
try:
  res = torch.nn.functional.interpolate(arg_1,scale_factor=arg_2,mode=arg_3,align_corners=arg_4,)
except Exception as e:
  print("Error:"+str(e))
```

Output:
```
Error:Storage size calculation overflowed with sizes=[1, 256, 17513998554710, 17513998554710]
```

### Versions

PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch
Integer multiplication overflow when running torch.eye
Labels: triaged, module: int overflow

### 🐛 Describe the bug

Due to a very large integer argument.

Code:
```
import torch
import numpy as np
arg_1 = 1250999896765
try:
  res = torch.eye(arg_1,)
except Exception as e:
  print("Error:"+str(e))
```

Log message:
```
Error:numel: integer multiplication overflow
```

### Versions

PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch
Integer calculation overflow when running torch.nn.functional.adaptive_avg_pool2d
Labels: triaged, module: int overflow

### 🐛 Describe the bug

Due to large integer list elements.

Code:
```
import torch
import numpy as np
arg_1_tensor = -torch.rand([128, 1024, 4, 4], dtype=torch.float32)
arg_1 = arg_1_tensor.clone()
arg_2_0 = 1250999896765
arg_2_1 = 1250999896764
arg_2 = [arg_2_0,arg_2_1,]
try:
  res = torch.nn.functional.adaptive_avg_pool2d(arg_1,arg_2,)
except Exception as e:
  print("Error:"+str(e))
```

Log message:
```
Error:numel: integer multiplication overflow
```

### Versions

### Versions

PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch
Integer overflow when running torch.nn.functional.upsample_bilinear
Labels: triaged, module: int overflow

### 🐛 Describe the bug

Due to a very large integer variable.


Code:

```
import torch
import numpy as np
arg_1_tensor = torch.neg(torch.rand([16, 512, 4, 4], dtype=torch.float32))
arg_1 = arg_1_tensor.clone()
arg_2_0 = 1250999896765
arg_2_1 = 1250999896766
arg_2 = [arg_2_0,arg_2_1,]
try:
  res = torch.nn.functional.upsample_bilinear(arg_1,size=arg_2,)
except Exception as e:
  print("Error:"+str(e))
```

Log message:

```
Error:Storage size calculation overflowed with sizes=[16, 512, 1250999896765, 1250999896766]
```a 

### Versions

PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch
Integer overflow when running torch.nn.functional.upsample
Labels: triaged, module: int overflow

### 🐛 Describe the bug

Due to large integer value.

```
import torch
import numpy as np
arg_1_tensor = torch.neg(torch.rand([1, 256, 14, 14], dtype=torch.float32))
arg_1 = arg_1_tensor.clone()
arg_2 = 1250999896766
arg_3 = "bilinear"
arg_4 = True
try:
  res = torch.nn.functional.upsample(arg_1,scale_factor=arg_2,mode=arg_3,align_corners=arg_4,)
except Exception as e:
  print("Error:"+str(e))
```

Log message:
```
Error:Storage size calculation overflowed with sizes=[1, 256, 17513998554724, 17513998554724
```

### Versions

PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch
Integer overflow when running torch.nn.ReplicationPad3d
Labels: triaged, module: int overflow

### 🐛 Describe the bug

Due to very large integer variable

```
import torch
import numpy as np
arg_1 = 1250999900000
arg_class = torch.nn.ReplicationPad3d(arg_1,)
arg_2_0_tensor = torch.rand([16, 3, 8, 320, 480], dtype=torch.float32)
arg_2_0 = arg_2_0_tensor.clone()
arg_2 = [arg_2_0,]
try:
  res = arg_class(*arg_2)
except Exception as e:
  print("Error:"+str(e))
```

Log message:
```
Error:Storage size calculation overflowed with sizes=[16, 3, 2501999800008, 2501999800320, 2501999800480]
```

### Versions

```
PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch
```
Integer overflow when running torch.nn.AdaptiveAvgPool2d
Labels: triaged, module: int overflow

### 🐛 Describe the bug

Due to large integer value:

Reproducible code:
```
import torch
import numpy as np
arg_1 = 1250999896765
arg_class = torch.nn.AdaptiveAvgPool2d(arg_1,)
arg_2_0_tensor = torch.rand([128, 2048, 2, 2], dtype=torch.float32)
arg_2_0 = arg_2_0_tensor.clone()
arg_2 = [arg_2_0,]
try:
  res = arg_class(*arg_2)
except Exception as e:
  print("Error:"+str(e))
```

Log message:

```
Error:numel: integer multiplication overflow
```

### Versions

```
PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch
```
Integer overflow when running torch.nn.MaxUnpool2d
Labels: triaged, module: int overflow

### 🐛 Describe the bug

Due to feeding large negative integer value.

```
import torch
import numpy as np
arg_1 = -44717
arg_2 = 2
arg_class = torch.nn.MaxUnpool2d(arg_1,stride=arg_2,)
arg_3_0_tensor = torch.rand([1, 1, 2, 2], dtype=torch.float32)
arg_3_0 = arg_3_0_tensor.clone()
arg_3_1_tensor = torch.randint(-8,4096,[1, 1, 2, 2], dtype=torch.int64)
arg_3_1 = arg_3_1_tensor.clone()
arg_3 = [arg_3_0,arg_3_1,]
try:
  res = arg_class(*arg_3)
except Exception as e:
  print("Error:"+str(e))
```

### Versions

```
PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch

```
Index out of bound when running torch.gather
Labels: triaged, module: advanced indexing

### 🐛 Describe the bug

Probably due to a very large negative input tensor.

```
import torch
arg_1_tensor = torch.randint(-128,32,[2, 2], dtype=torch.int64)
arg_1 = arg_1_tensor.clone()
arg_2 = 1
arg_3_tensor = torch.randint(-4096,4096,[2, 2], dtype=torch.int64)
arg_3 = arg_3_tensor.clone()
try:
  results["res_cpu"] = torch.gather(arg_1,arg_2,arg_3,)
except Exception as e:
  print("Error:"+str(e))
arg_1 = arg_1_tensor.clone().cuda()
arg_3 = arg_3_tensor.clone().cuda()
try:
  results["res_gpu"] = torch.gather(arg_1,arg_2,arg_3,)
except Exception as e:
  print("Error:"+str(e))
```

### Versions

```
PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch

```
Integer overflow when running torch.nn.functional.max_unpool2d
Labels: triaged, module: int overflow

### 🐛 Describe the bug

The implementation of torch.nn.functional.max_unpool2d throws:
```
numel: integer multiplication overflow
```
When feeding large input tensor or negative integer values.

The test case:

```
import torch
import numpy as np
arg_1_tensor = torch.neg(torch.rand([1, 1, 2, 2], dtype=torch.float32))
arg_1 = arg_1_tensor.clone()
arg_2_tensor = torch.randint(-4096,32,[1, 1, 2, 2], dtype=torch.int64)
arg_2 = arg_2_tensor.clone()
arg_3_0 = False
arg_3_1 = True
arg_3 = [arg_3_0,arg_3_1,]
arg_4_0 = -78819
arg_4_1 = -23458
arg_4 = [arg_4_0,arg_4_1,]
arg_5_0 = 0
arg_5_1 = 0
arg_5 = [arg_5_0,arg_5_1,]
arg_6 = None
try:
  res = torch.nn.functional.max_unpool2d(arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,)
except Exception as e:
  print("Error:"+str(e))
```

### Versions

```
PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1660 Ti
Nvidia driver version: 525.60.11
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] torch==1.12.0
[pip3] torchaudio==0.12.0
[pip3] torchvision==0.13.0
[conda] blas 1.0 mkl
[conda] cudatoolkit 11.3.1 h2bc3f7f_2
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[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.5 py39h14f4228_0
[conda] numpy-base 1.23.5 py39h31eccc5_0
[conda] pytorch 1.12.0 py3.9_cuda11.3_cudnn8.3.2_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.12.0 py39_cu113 pytorch
[conda] torchvision 0.13.0 py39_cu113 pytorch
```
Appending new logs to existing tbevent files when using tensorboard
Labels: triaged, module: tensorboard

### 🚀 The feature, motivation and pitch

Use Case:
I often find myself needing to continue logging training progress to an existing event file when using tensorboard, especially when experiments are interrupted or need to be continued across multiple sessions. Currently, the SummaryWriter in PyTorch starts a new event file for each run, making it challenging to maintain a consistent log of progress, and creates multiple files in my directory.

Feature Request:
I would like to suggest adding the capability to append new logs to an existing tfevent file using the SummaryWriter. This would enable users to continue logging to a single event file across multiple runs, ensuring a seamless record of training progress.

Implementation Considerations:
While I don't have specific technical details, this feature might involve:

- Providing an option to specify an existing event file when creating a SummaryWriter instance.
- Ensuring that logs from the current run are appropriately appended to the specified event file.
- Handling potential conflicts or edge cases when appending logs.

This feature would greatly enhance the usability of the SummaryWriter and improve the logging experience for PyTorch users.


### Alternatives

_No response_

### Additional context

_No response_
[Inductor] Autotuner Integration
Labels: open source, module: inductor, ciflow/inductor

```sh
# E2E Integration
## XGB BASELINE
rm -rf /scratch/bohanhou/fresh/hf-model-0-0-training/;TORCHINDUCTOR_AUTOTUNER_PATH=/scratch/bohanhou/fresh/new_experiments/xgb_baseline/xgb_baseline.pkl TORCHINDUCTOR_CACHE_DIR=/scratch/bohanhou/fresh/hf-model-0-0-training/ TORCHINDUCTOR_AUTOTUNER_SPACE=0 TORCH_LOGS="+inductor" TORCHINDUCTOR_BENCHMARK_KERNEL=1 python3 benchmarks/dynamo/huggingface.py --amp --performance --training --inductor -d cuda --device-index 0 --output hf-model-0-0-training.csv >./hf-model-0-0-training.log 2>&1
rm -rf /scratch/bohanhou/fresh/hf-model-0-2-training/;TORCHINDUCTOR_AUTOTUNER_PATH=/scratch/bohanhou/fresh/new_experiments/xgb_baseline/xgb_baseline.pkl TORCHINDUCTOR_CACHE_DIR=/scratch/bohanhou/fresh/hf-model-0-2-training/ TORCHINDUCTOR_AUTOTUNER_SPACE=2 TORCH_LOGS="+inductor" TORCHINDUCTOR_BENCHMARK_KERNEL=1 python3 benchmarks/dynamo/huggingface.py --amp --performance --training --inductor -d cuda --device-index 0 --output hf-model-0-2-training.csv >./hf-model-0-2-training.log 2>&1
## NN Pointwise
rm -rf /scratch/bohanhou/fresh/hf-model-1-0-training/;TORCHINDUCTOR_AUTOTUNER_PATH=/scratch/bohanhou/fresh/new_experiments/nn_pointwise/nn_pointwise_True_1400_0.0420697318410453_0.02314407822228018.pkl TORCHINDUCTOR_CACHE_DIR=/scratch/bohanhou/fresh/hf-model-1-0-training/ TORCHINDUCTOR_AUTOTUNER_SPACE=0 TORCH_LOGS="+inductor" TORCHINDUCTOR_BENCHMARK_KERNEL=1 python3 benchmarks/dynamo/huggingface.py --amp --performance --training --inductor -d cuda --device-index 0 --output hf-model-1-0-training.csv >./hf-model-1-0-training.log 2>&1
rm -rf /scratch/bohanhou/fresh/hf-model-1-2-training/;TORCHINDUCTOR_AUTOTUNER_PATH=/scratch/bohanhou/fresh/new_experiments/nn_pointwise/nn_pointwise_True_1400_0.0420697318410453_0.02314407822228018.pkl TORCHINDUCTOR_CACHE_DIR=/scratch/bohanhou/fresh/hf-model-1-2-training/ TORCHINDUCTOR_AUTOTUNER_SPACE=2 TORCH_LOGS="+inductor" TORCHINDUCTOR_BENCHMARK_KERNEL=1 python3 benchmarks/dynamo/huggingface.py --amp --performance --training --inductor -d cuda --device-index 0 --output hf-model-1-2-training.csv >./hf-model-1-2-training.log 2>&1
## NN L2R
rm -rf /scratch/bohanhou/fresh/hf-model-2-0-training/;TORCHINDUCTOR_AUTOTUNER_PATH=/scratch/bohanhou/fresh/new_experiments/nn_l2r/nn_l2r_True_700_0.0003389147304638488_0.8339776992797852.pkl TORCHINDUCTOR_CACHE_DIR=/scratch/bohanhou/fresh/hf-model-2-0-training/ TORCHINDUCTOR_AUTOTUNER_SPACE=0 TORCH_LOGS="+inductor" TORCHINDUCTOR_BENCHMARK_KERNEL=1 python3 benchmarks/dynamo/huggingface.py --amp --performance --training --inductor -d cuda --device-index 0 --output hf-model-2-0-training.csv >./hf-model-2-0-training.log 2>&1
```

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):
* #107615
* #107489
* __->__ #107488



cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @ngimel @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov
Add drop_remainder & redistribute to torch.chunk and drop_remainder for torch.split
Labels: module: cpu, triaged, open source, module: amp (automated mixed precision), NNC, release notes: quantization, topic: not user facing, ciflow/mps, module: inductor, module: dynamo, ciflow/inductor, module: export, suppress-bc-linter

Implements the exact expected behavior described [here](https://github.com/pytorch/pytorch/issues/60531#issuecomment-870986104).

Fixes #60531

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @mcarilli @ptrblck @leslie-fang-intel @EikanWang @voznesenskym @penguinwu @Guobing-Chen @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov @ColinPeppler @avikchaudhuri @gmagogsfm @zhxchen17 @tugsbayasgalan
[ROCm] support caffe2 operator export
Labels: module: rocm, triaged, open source, rocm

PyTorch on ROCm masquerades as the CUDA device. caffe2 instead uses a HIP device.  A caffe2 operator exported to pytorch expects a HIP device type. This PR adds a global thread_local setting to caffe2 that is only used during caffe2 operator export to force caffe2's HIPContext to also masquerade as CUDA.

- The caffe2 HIP allocator is additionally registered for CUDA
- New caffe2 APIs IsHipMasqueradingAsCuda, SetHipMasqueradingAsCuda
- C10_EXPORT_CAFFE2_OP_TO_C10_HIP additionally registers for CUDA
- modify one unit test in torch_test.py to also try CUDA device for exported op


cc @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @dllehr-amd @jataylo @hongxiayang