gopikrsmscs/torch-issues huggingface dataset:
Jacfwd become slower after update pytorch ("We’ve integrated functorch into PyTorch---Documentation")
Labels: high priority, needs reproduction, triaged, module: functorch

Hello, I used to use 
```
from functorch import jacfwd
```
and Jacfwd takes 3.5s, after the update, I am using
```
from torch.func import jacfwd
```
Jacfwd is taking almost 6s, is anyone noticed this?

cc @ezyang @gchanan @zou3519 @Chillee @samdow @soumith @kshitij12345 @janeyx99
Support polyphase channelizer
Labels: feature, triaged, module: fft

### 🚀 The feature, motivation and pitch

When doing audio or in general 1D time series data processing, one can use `torch.stft()` to convert 1D into 2D data. One can then use a 2D model for the actual task. However, `torch.sftf()` is a spectral analysis operation. Really, you want a polyphase channelizer, which may look similar, but isn't, and is efficiently channelizing your data into equally spaced (in frequency) downsampled time series channels.


### Alternatives

_No response_

### Additional context

_No response_

cc @mruberry @peterbell10
'Illegal instruction (core dumped)' for gpt-j bf16 generation task using greedy search 
Labels: module: crash, module: cpu, triaged, module: intel

### 🐛 Describe the bug

GPT-J model bf16 inference crashes for generation task with greedy search. 
 **Error info:**
`Illegal instruction (core dumped)`
```python 
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
import torch

generate_kwargs = dict(do_sample=False, temperature=0.9)
model_id = "EleutherAI/gpt-j-6B"
model = AutoModelForCausalLM.from_pretrained(model_id, low_cpu_mem_usage=True)
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = model.eval()
model = model.to(torch.bfloat16)

# 32 tokens input
prompt = "Once upon a time, there existed a little girl, who liked to have adventures." + \
         " She wanted to go to places and meet new people, and have fun."

input_ids = tokenizer(prompt, return_tensors="pt").input_ids
gen_tokens = model.generate(input_ids, max_new_tokens=32, **generate_kwargs)
gen_text = tokenizer.batch_decode(gen_tokens)[0]
print(gen_text)
```

### Versions

torch              2.1.0.dev20230418+cpu

cc @frank-wei @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10
Not Preserving Grad For Tensor Created Inside torch.compile
Labels: triaged, oncall: pt2, module: aotdispatch

### 🐛 Describe the bug
```
import torch

def foo():
    x = torch.randn(5, 5, requires_grad=True)
    y = x + 2
    return x, y

x, y = foo()
print(x.requires_grad, y.requires_grad)
# True True

x, y = torch.compile()(foo)()
print(x.requires_grad, y.requires_grad)
# False False
```

### Versions

master

cc @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @desertfire
vision_maskrcnn failing on periodic dynamic_aot_eager_torchbench
Labels: triaged, oncall: pt2, module: dynamic shapes

### 🐛 Describe the bug

For example https://hud.pytorch.org/pytorch/pytorch/commit/2611fccfed83669a3f1221af0131bb99d3f6dbb1

Command to reproduce:

`PYTHONPATH=$(pwd)/torchbench python benchmarks/dynamo/torchbench.py --accuracy --backend aot_eager --dynamic-shapes --dynamic-batch-only --device cuda --inference --amp --only vision_maskrcnn`

It fails with the error `RecursionError: maximum recursion depth exceeded in __instancecheck__`

### Versions

PyTorch CI

cc @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @desertfire
RuntimeError: "replication_pad1d_cuda" not implemented for 'BFloat16'
Labels: module: cuda, triaged, module: bfloat16

### 🐛 Describe the bug

I am using the [diffsptk](https://github.com/sp-nitech/diffsptk) library PQMF functionality, because it has low reconstruction error.

When enabling BFloat16, I get the following error:

```
  File "/home/ubuntu/spooky-source-separation/demucs_lightning/demucs/pqmf.py", line 64, in reconstruct
    x = self.pqmf.reconstruct(x)
  File "/home/ubuntu/spooky-source-separation/demucs_lightning/demucs/pqmf.py", line 32, in reconstruct
    x = self.ipqmf(self.interpolate(self.n_subbands * x, dim=-1), keepdim=False)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/diffsptk/core/ipqmf.py", line 99, in forward
    x = F.conv1d(self.pad(y), self.filters)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/torch/nn/modules/container.py", line 217, in forward
    input = module(input)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/torch/nn/modules/padding.py", line 335, in forward
    return F.pad(input, self.padding, 'replicate')
RuntimeError: "replication_pad1d_cuda" not implemented for 'BFloat16'
```

### Versions

Sorry this link is broken and I googled for it, but I am happy to run it if you provide me with an updated link.

```
In [5]: torch.__version__                                                                                             
Out[5]: '2.0.0+cu117'
```

cc @ngimel
Question about GRU(RNN/LSTM) outputs shape
Labels: module: docs, module: nn, module: rnn, triaged, actionable

### 📚 The doc issue

[https://pytorch.org/docs/1.8.1/generated/torch.nn.GRU.html#torch.nn.GRU](https://pytorch.org/docs/1.8.1/generated/torch.nn.GRU.html#torch.nn.GRU)
[https://pytorch.org/docs/1.9.0/generated/torch.nn.GRU.html#torch.nn.GRU](https://pytorch.org/docs/1.9.0/generated/torch.nn.GRU.html#torch.nn.GRU)
Versions of pytorch after 1.9.0 have made some changes to the GRU(RNN/LSTM?) documentation.

The h_n of shape of 1.8.1 is like this:
  **(num_layers * num_directions, batch, hidden_size):**
The h_n of shape of 1.9 is like this:
**(D∗num_layers,N,Hout)**
where D is "2 if bidirectional=True otherwise 1"
So I think D is the num_directions of the previous version, then h_n of shape after 1.9.0 is:
  **(num_directions * num_layers, batch, hidden_size)**

This is inconsistent with the order of the previous version in the first two dimensions. What should I do if I want to fetch the data of the last layer? Is there something wrong with my understanding?

In addition, I also found that two different descriptions exist at the same time in version 2.0, which is a bit confusing...
[https://pytorch.org/docs/stable/generated/torch.ao.nn.quantized.dynamic.GRU.html](https://pytorch.org/docs/stable/generated/torch.ao.nn.quantized.dynamic.GRU.html)
[https://pytorch.org/docs/stable/generated/torch.nn.GRU.html#torch.nn.GRU](https://pytorch.org/docs/stable/generated/torch.nn.GRU.html#torch.nn.GRU)

### Suggest a potential alternative/fix

_No response_

cc @svekars @carljparker @albanD @mruberry @jbschlosser @walterddr @mikaylagawarecki @zou3519
The meta implementation of `index_put` does not do any check
Labels: triaged, module: meta tensors, release notes: Meta API

### 🐛 Describe the bug

For example, the following code breaks in eager but successfully runs under `torch.compile`:

```python
Before, the following code would not error out

@compile()
def f(x, y, z):
    x.index_put_((y,), z)
    return x

x = torch.randn(3, 2, 4, device="cuda")
y = torch.arange(2, device="cuda")
z = torch.zeros(4, 2, 4, device="cuda")
f(x, y, z)
```

FWIW, reusing the meta function from `index.Tensor` breaks every subsystem. See https://github.com/pytorch/pytorch/pull/98589. I've seen that most tests special-case `index.Tensor`, so something similar would need to be done for this function.

### Versions

master

cc @ezyang @eellison @bdhirsh @soumith
torch.nn.functional.multilabel_margin_loss cuda lacks checking of "out of bound"
Labels: module: nn, module: cuda, module: error checking, triaged

### 🐛 Describe the bug

Though [#73176](https://github.com/pytorch/pytorch/issues/73176) lists a lot of APIs lacks checking out of bound in cuda. It still  can be repro in torch.nn.functional.multilabel_margin_loss.
```
import torch
results={}
arg_1 = torch.as_tensor([[0.0360, 0.6321, 0.6267, 0.4555]])
print(arg_1)
arg_2 = torch.as_tensor([[-2489,  -776,   380, -1566]])
print(arg_2)
arg_3 = "mean"
try:
  results["res_cpu"] = torch.nn.functional.multilabel_margin_loss(input=arg_1,target=arg_2,reduction=arg_3,)
except Exception as e:
  results["err_cpu"] = "ERROR:"+str(e)
arg_1 = arg_1.clone().cuda()
arg_2 = arg_2.clone().cuda()
try:
  results["res_gpu"] = torch.nn.functional.multilabel_margin_loss(input=arg_1,target=arg_2,reduction=arg_3,)
except Exception as e:
  results["err_gpu"] = "ERROR:"+str(e)
print(results)
#res: {'err_cpu': "ERROR:argument #2 'target' is out of range", 'res_gpu': tensor(0., device='cuda:0')}
```

Also it still can be seen in torch.nn.MultiLabelMarginLoss, even though [#73176](https://github.com/pytorch/pytorch/issues/73176) has fixed this issue.
```
import torch
results={}
arg_class = torch.nn.MultiLabelMarginLoss()
arg_1_0 = torch.as_tensor([[0.3449, 0.5441, 0.7594, 0.5161]])
print(arg_1_0)
arg_1_1 = torch.as_tensor([[-59,  45, 187, 131]])
print(arg_1_1)
arg_1 = [arg_1_0,arg_1_1,]
try:
  results["res_cpu"] = arg_class(*arg_1)
except Exception as e:
  results["err_cpu"] = "ERROR:"+str(e)
arg_class = arg_class.cuda()
arg_1_0 = arg_1_0.clone().cuda()
arg_1_1 = arg_1_1.clone().cuda()
arg_1 = [arg_1_0,arg_1_1,]
try:
  results["res_gpu"] = arg_class(*arg_1)
except Exception as e:
  results["err_gpu"] = "ERROR:"+str(e)
print(results)
# results: {'err_cpu': "ERROR:argument #2 'target' is out of range", 'res_gpu': tensor(0., device='cuda:0')}
```


### Versions

pytorch version: 2.0.0+cu118

cc @albanD @mruberry @jbschlosser @walterddr @mikaylagawarecki @ngimel @malfet
FakeTensor lacks support for sparse compressed tensors
Labels: module: sparse, triaged, module: fakeTensor


## Issue description

As in the title.

This lack of support prevents using `OpInfo.error_input_func` for sparse compressed tensors. For instance, `test_python_ref_errors` would fail with `UnsupportedFakeTensorException` on an `ErrorInput` instance that contains a sparse compressed tensor as a sample input (ref: https://github.com/pytorch/pytorch/actions/runs/4723316774/jobs/8379634648).

## Code example

```python
>>> import torch
>>> from torch._subclasses.fake_tensor import FakeTensorMode, FakeTensor
>>> mode = FakeTensorMode()
>>> FakeTensor.from_tensor(torch.tensor([[1, 2], [3, 4]]).to_sparse_csr(), mode)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pearu/git/pytorch/pytorch-sparse-compressed/torch/_subclasses/fake_tensor.py", line 922, in from_tensor
    return fake_mode.from_tensor(t)
  File "/home/pearu/git/pytorch/pytorch-sparse-compressed/torch/_subclasses/fake_tensor.py", line 1437, in from_tensor
    return self.fake_tensor_converter(
  File "/home/pearu/git/pytorch/pytorch-sparse-compressed/torch/_subclasses/fake_tensor.py", line 328, in __call__
    return self.from_real_tensor(
  File "/home/pearu/git/pytorch/pytorch-sparse-compressed/torch/_subclasses/fake_tensor.py", line 292, in from_real_tensor
    raise UnsupportedFakeTensorException("meta converter nyi")
torch._subclasses.fake_tensor.UnsupportedFakeTensorException: meta converter nyi
```

## System Info

- PyTorch version: main

cc @alexsamardzic @nikitaved @cpuhrsch @amjames @bhosmer
Support `cond` branches that reference variables defined in an outer scope
Labels: triaged, oncall: pt2, module: dynamo, module: export

### 🚀 The feature, motivation and pitch

Related: https://github.com/pytorch/pytorch/issues/90469

Attempting to inline a nested function that closes over variables in outer scopes results in an error. For example, the following module cannot be exported:

```
class ModuleClosureReproError(torch.nn.Module):
            # error
            def __init__(self):
                super().__init__()
                self.linear = torch.nn.Linear(3, 3)

            def forward(self, pred, x):
                y = x + x

                def true_fn(val):
                    return self.linear(val) * (x + y)

                def false_fn(val):
                    return val * (y - x)

                return cond(pred, true_fn, false_fn, [x])
```

### Alternatives

The workaround today is to rewrite such functions to take closed-over variables as additional arguments.

### Additional context

_No response_

cc @ezyang @msaroufim @wconstab @bdhirsh @anijain2305 @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov @kadeng @soumith @ngimel @desertfire
torch.compile error
Labels: triaged, oncall: pt2, module: cpu inductor

### 🐛 Describe the bug

When I used torch.compile to compile and accelerate this code https://github.com/CompVis/stable-diffusion/blob/21f890f9da3cfbeaba8e2ac3c425ee9e998d5229/scripts/txt2img.py#L303, this error occurred.

In file included from /tmp/torchinductor_hujiahao1/zt/cztcl2vp5yqlnhofzpqfficjcxgyict6e3xhfdd7sdbkipp4p44x.h:8:0,
                 from /tmp/torchinductor_hujiahao1/ke/ckeyipvhzljoe53twvjbo23ihq2q26ser2onsutamnzl7ytce5dn.cpp:2:
/home/hujiahao1/anaconda3/envs/ldm/lib/python3.8/site-packages/torch/include/ATen/core/PhiloxRNGEngine.h:199:35: error: enclosing class of constexpr non-static member function ‘float at::philox_engine::uint32_to_uniform_float(uint32_t)’ is not a literal type
   C10_HOST_DEVICE constexpr float uint32_to_uniform_float(uint32_t value) {
                                   ^
In file included from /tmp/torchinductor_hujiahao1/zt/cztcl2vp5yqlnhofzpqfficjcxgyict6e3xhfdd7sdbkipp4p44x.h:8:0,
                 from /tmp/torchinductor_hujiahao1/ke/ckeyipvhzljoe53twvjbo23ihq2q26ser2onsutamnzl7ytce5dn.cpp:2:
/home/hujiahao1/anaconda3/envs/ldm/lib/python3.8/site-packages/torch/include/ATen/core/PhiloxRNGEngine.h:68:7: note: ‘at::philox_engine’ is not literal because:
 class philox_engine {
       ^
/home/hujiahao1/anaconda3/envs/ldm/lib/python3.8/site-packages/torch/include/ATen/core/PhiloxRNGEngine.h:68:7: note:   ‘at::philox_engine’ is not an aggregate, does not have a trivial default constructor, and has no constexpr constructor that is not a copy or move constructor
/tmp/torchinductor_hujiahao1/ke/ckeyipvhzljoe53twvjbo23ihq2q26ser2onsutamnzl7ytce5dn.cpp: In function ‘void kernel(float*)’:
/tmp/torchinductor_hujiahao1/ke/ckeyipvhzljoe53twvjbo23ihq2q26ser2onsutamnzl7ytce5dn.cpp:13:26: error: ‘simdlen’ is not valid for ‘#pragma omp simd’
         #pragma omp simd simdlen(4) 
                          ^


Set torch._dynamo.config.verbose=True for more information


You can suppress this exception and fall back to eager by setting:
    torch._dynamo.config.suppress_errors = True

### Versions

not found collect_env.py
my env:
torch 2.0.0
cuda 11.8
gcc 5.3
cmake 3.26.3

cc @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh
add `-std=c++20` build-only CI job
Labels: module: build, module: ci, triaged, module: devx

### 🚀 The feature, motivation and pitch

We won't be adopting C++20 any time soon, but we do have users who wish to build with it. We should keep our code at least building with C++20, using whatever CI config is the cheapest to keep it working.

I'm happy to get the code working if someone else can contribute the CI job.

See #99013 #85703 #98917 for some related issues/changes.

### Alternatives

_No response_

### Additional context

_No response_

cc @malfet @seemethere @pytorch/pytorch-dev-infra @ZainRizvi @kit1980 @huydhn @clee2000
we should make semantically meaningless positional arguments positional only in our operator API
Labels: feature, triaged, actionable, module: python array api, module: python frontend

### 🚀 The feature, motivation and pitch

See #99265 for an example of some of the chaos this causes. Position-only arguments were added in Python 3.8 and we recently dropped support for 3.7 so now is the first opportunity to do this.

Prior art: the Python array API is aggressively using position only arguments.

Removing this will be BC breaking, so here is a rough idea for how it should be done.
1. add support for doing this in our codegen
2. add a linter to prevent new uses of things like tensor1, tensor2, etc.
3. add a warning that fires when calling existing functions with named arguments
4. remove warning and migrate to position only arguments after a release


@mruberry @rgommers 

### Alternatives

_No response_

### Additional context

_No response_

cc @mruberry @rgommers @pmeier @asmeurer @leofang @AnirudhDagar @asi1024 @emcastillo @kmaehashi @albanD
torch.linalg.lstsq doc arguments error
Labels: module: docs, triaged, module: linear algebra

### 📚 The doc issue

According to [doc](https://pytorch.org/docs/stable/generated/torch.linalg.lstsq.html), the arguments of torch.linalg.lstsq are `A`、`B`、`rcond`、`driver`. But when using these arguments, below code will throw exception: `ERROR:linalg_lstsq() missing 2 required positional argument: "input", "b"`. Actually the arguments should be `input`、`b`、`rcond`、`driver`.
```
import torch
arg_1 = torch.rand([5, 3], dtype=torch.float32)
arg_2 = torch.rand([5, 3], dtype=torch.float32)
results = torch.linalg.lstsq(A=arg_1,B=arg_2,)
print(results)
```

### Suggest a potential alternative/fix

_No response_

cc @svekars @carljparker @jianyuh @nikitaved @pearu @mruberry @walterddr @IvanYashchuk @xwang233 @Lezcano
Torch func Documentation for trees
Labels: module: docs, triaged, module: functorch

### 📚 The doc issue

`functorch` / `torch.func` seems to support pytrees similar to `JAX`. However, there seems to be no documentation on that.

For example, this works:

```
import torch.func as FT
import torch

a = {
    "A": torch.randn(2,2),
    "inner": {
        "B": torch.randn(2,2),
        "C": torch.randn(2,2)
        }
    }

b = [
    torch.randn(2,2),
    torch.randn(2,2),
]

def f(x, y):
    return (x["A"] + x["inner"]["B"] @ x["inner"]["C"]).sum() + y[0].sum() + y[1].sum()


grad, val = FT.grad_and_value(f, argnums=(0,1))(a, b)

print(grad)
```

But I couldnt find anything in the docs, nor does there seem to be a `tree_utils` package like in JAX.

### Suggest a potential alternative/fix

It would be useful to clarify what is possible and what isnt.

cc @svekars @carljparker @zou3519 @Chillee @samdow @soumith @kshitij12345 @janeyx99
CI for s390x
Labels: module: ci, triaged, enhancement

It'd be great to have s390x CI for pytorch. It'd help to improve support for s390x in pytorch.

It's possible to request s390x machine for CI for pytorch. Only question is who'll manage it: pytorch maintainers or us. For me first option would be more convenient, but second one is also possible.

cc @seemethere @malfet @pytorch/pytorch-dev-infra
There has implmenet bug in LTC IrBuilder's MakeSizeMul method.
Labels: triaged, lazy, module: lazy

The default implementation of LTC IrBuilder's MakeSizeMul has error called method. The detail code is listed as below: 
```c++
static inline NodePtr MakeSizeMul(const Value& a, const Value& b) {
  return getIrBuilder()->MakeSizeAdd(a, b);
}
```
It is located in `pytorch/torch/csrc/lazy/core/ir_builder.h`, and the currently `main` branch also has this bug.

### Versions

The nightly main branch.
Slicing and indexing support negative steps
Labels: feature, triaged, module: advanced indexing

### 🚀 The feature, motivation and pitch

At present pytorch is not compatible with the following code(pytorch 2.0), and will raise an error 'step must be greater than zero'
```
a=torch.arange(12).float()
print(a[::-1])
```
At the same time, this is always available in numpy. Is it possible this basic feature be add in pytorch in the near future?


### Alternatives

An alternative to this is using torch.flip(a, dims=[0]), but it would be great if [::-1] can be used in both 0d/1d and multidim tensors.

### Additional context

_No response_
Automatically set dropout for SDPA depending on training mode / `training` argument
Labels: enhancement, oncall: transformer/mha

### 🚀 The feature, motivation and pitch

Hi,

`torch.nn.functional.dropout` has a `training` argument that allows to disable/enable dropout during inference. In a module, it simplifies code by passing simply `training=self.training` instead of `p=self.droupout_p if self.training else 0.0`. This avoids as well a python controlflow (that dynamo may not like).

```python
a = torch.rand(20, 30)
b = torch.nn.functional.dropout(a, p=0.5, training=False)
```

It would be great to have a similar option in `torch.nn.scaled_dot_product_attention`, as e.g. `eval()` does not change the behavior (dummy example):

```python
import torch
import torch.nn as nn

class MyModel(nn.Module):
    def __init__(self):
        super().__init__()

        self.q = nn.Parameter(torch.rand(1, 64, 32, 64, dtype=torch.float16).to("cuda"))
        self.k = nn.Parameter(torch.rand(1, 64, 32, 64, dtype=torch.float16).to("cuda"))
        self.v = nn.Parameter(torch.rand(1, 64, 32, 64, dtype=torch.float16).to("cuda"))
        
    def forward(self, x):
        res = torch.nn.functional.scaled_dot_product_attention(self.q, self.k, self.v, is_causal=True, dropout_p=0.8) * x
        return res

model = MyModel()
model = model.eval()
inp = torch.Tensor([3.]).to("cuda", torch.float16)
with torch.inference_mode():
    res = model(inp)

print(res)
"""
prints
tensor([[[[0.0000, 0.0000, 0.0000,  ..., 0.0000, 0.0000, 0.0000],
          [0.0000, 0.0000, 0.0000,  ..., 0.0000, 0.0000, 0.0000],
          [0.0000, 0.0000, 0.0000,  ..., 0.0000, 0.0000, 0.0000],
          ...,
          [1.0000, 0.4944, 0.9648,  ..., 0.9160, 0.9844, 1.2383],
          [0.0000, 0.0000, 0.0000,  ..., 0.0000, 0.0000, 0.0000],
          [3.4277, 1.6973, 2.8184,  ..., 3.3672, 2.6348, 2.9453]],
...
"""
```

cc @jbschlosser @bhosmer @cpuhrsch @erichan1 @drisspg @mikekgfb

### Alternatives

Adding a controlflow

### Additional context

/
Add `TORCH_ASSERT_ONLY_METHOD_OPERATORS` to functorch codebase
Labels: triaged, better-engineering, module: functorch

### 🚀 The feature, motivation and pitch

`TORCH_ASSERT_ONLY_METHOD_OPERATORS` was introduced to the native codebase a few months ago, and it brings us a significant speed-up in terms of incremental compilation because the codebase doesn't need to be re-compiled every time an operator is changed or added.

Therefore, I would like to propose adding `TORCH_ASSERT_ONLY_METHOD_OPERATORS` to the functorch codebase.

If this sounds a good idea I can propose PRs doing so.

### Alternatives

_No response_

### Additional context

_No response_

cc @zou3519 @Chillee @samdow @soumith @kshitij12345 @janeyx99
Remove lr_scheduler.print_lr
Labels: module: optimizer, triaged, module: LrScheduler

### 📚 The doc issue

The purpose of `print_lr` is unclear, and arguments are undocumented.
Also, the API is counter-intuitive. For example, in python API, we do not use `print('hello', verbose=False)` to not print something, and here the `verbose` is even a required argument. Instead, the user should put an if condition before calling the print function.

Related thread: https://discuss.pytorch.org/t/how-to-use-print-lr-in-the-lr-scheduler/132420
Source: https://github.com/pytorch/pytorch/blob/master/torch/optim/lr_scheduler.py#L113-L124

### Suggest a potential alternative/fix

I suggest removing that function since users can still simply get the current LR via `get_last_lr` and design the printing message on their own.


cc @vincentqb @jbschlosser @albanD @janeyx99
[MPS] Add lu_factor
Labels: open source, release notes: mps, ciflow/mps

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):
* __->__ #99269

<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at d75cde1</samp>

Added MPS support and autograd formulas for LU factorization of tensors. Implemented the `linalg_lu_factor` and `linalg_lu_factor.out` functions for the MPS backend in `LinearAlgebra.mm` and added tests in `test_mps.py`. Added the corresponding dispatch entries in `native_functions.yaml` and the backward and forward formulas in `derivatives.yaml`.
Embedding layer tensor shape
Labels: needs reproduction, triaged, module: embedding

### 🐛 Describe the bug

I use captum.attr.LayerIntegratedGradients to provide some insight on the embedding layer. During the process, the mebdedding layer is called multiple time. On one occasion, it shows a bizarre behavior in terms of the tensor shape, that I can hardly explain. In the trace mose, I ran this command:

`y = x[:1,:1]
y
tensor([[242]], dtype=torch.int32)
self.embedding_matrix
Embedding(12507, 300, padding_idx=0)
z = self.embedding_matrix(y)
z.shape
torch.Size([1600, 20, 300])
type(self.embedding_matrix)
<class 'torch.nn.modules.sparse.Embedding'>
z = self.embedding_matrix(y.long())
z.shape
torch.Size([1600, 20, 300])`
<img width="367" alt="image" src="https://user-images.githubusercontent.com/30732870/232330519-37aa53f0-77a5-4e7a-8abc-7572457824d4.png">

My expectation was to get a [1,1,300] matrix, and not [1600, 20, 300]. 

### Versions

Versions:
I have tried on both 2.0.0, and 1.9.0, and the same behavior was observed.
the error message of torch.addcmul is wrong
Labels: module: error checking, triaged

### 🐛 Describe the bug

```
import torch
result={}
arg_1 = torch.rand([], dtype=torch.float64)
arg_2 = 0.5
result = torch.addcmul(tensor2=arg_1,value=arg_2,)
print(result)
```
Above code throws an exception `TypeError: addcmul() received an invalid combination of arguments - got unrecognized keyword arguments: tensor2`. But accroding to [doc](https://pytorch.org/docs/stable/generated/torch.addcmul.html) ,`tensor2` is keyword arguments. I think the error message should be `Error:addcmul() missing 2 required positional argument: "input", "tensor1"`

### Versions

pytorch version: 2.0.0+cu118

cc @svekars @carljparker @malfet
tools PYTHONPATH trick in run_test.py does not work reliably
Labels: triaged, module: testing

### 🐛 Describe the bug

Steps to reproduce:
1. python setup.py develop in torchtext
2. Try to run `run_test.py`

Expected result: all imports work

Actual result: the tools/ import fails (and is suppressed). This is because we accidentally pick up the tools/ folder in torchtext first, before our newly added path gets triggered.

I tried to fix this in https://github.com/pytorch/pytorch/pull/99173 but it didn't work for other reasons.

The most reliable fix would be to move these files into torch/_testing so that they are in a proper module.

### Versions

master
Broken link for torch dynamo FAQ in docs
Labels: triaged, topic: docs

### 📚 The doc issue

I was reading in the docs and learning about torch dynamo (its very cool ;)). There was a broken link that redirects the user to a "dead end" page. I created a PR to correct the link in the docs.

#99242 

### Suggest a potential alternative/fix

Correct the link as in the PR (maybe?)
Adding MPS support for 3D convolutions
Labels: triaged, open source, Stale, ciflow/trunk, release notes: mps, ciflow/mps

Fixes #77818
- this pull request enables 3D convolutions (forward/backward) for MPS (Apple Silicon) within the same Convolution.mm file as conv2d.
- does not support channel_last (since pytorch doesn't implement channel_last for 3D tensors)
- does not support conv3d_transpose and treats depth-separable convolutions not as normal case (there are no MPS kernels available for either of those so far)  
- requires MacOS >=13.2 (Ventura), I'm not sure how to add this specific case to MPSGraphVenturaOps.h 
@kulinseth @albanD could you please check whether this is implemented as intended by you and whether we would require additional tests in test_mps.py?
vision_maskrcnn failing in periodic/trunk
Labels: triaged, bug, oncall: pt2

<img width="1668" alt="image" src="https://user-images.githubusercontent.com/4984825/232229096-cabf4a9d-23bc-4b3d-ab8e-ebc85e4b6171.png">
Failures appear to start with #98923.

Note: i also tried and failed to bisect an issue with vision_maskrcnn on inductor earlier this week, because looking at the pt2dash it looked like there was a drop between these revisions.  However when bisecting, I found all revs were failing, but the error message changed at some point.
Good: 670c5cf96249db28cde757da5a6aa97569760102 
Bad: c4f81cb6f49fe69f3a04867f9c445923af69113

cc @ezyang @soumith @msaroufim @ngimel @bdhirsh
Libtorch consumes too much memory as 16225
Labels: module: cpp, module: memory usage, triaged

### 🐛 Describe the bug

I met the same problem as https://github.com/pytorch/pytorch/issues/16255 when I was using latest libtorch . I convert resnet152 in torchvision to torchscript model. The following is my code:

#include <torch/torch.h>
#include <torch/script.h>

#include <nvToolsExt.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include <vector>
#include <chrono>
#include <pthread.h>

void run_inference(torch::jit::script::Module& model, std::vector<torch::jit::IValue>& imgs)
{
	for (int i = 0; i < 100; ++i)
		model.forward(imgs);

	torch::cuda::synchronize();

}

int main(int arc, char** argv) {
	
	c10::InferenceMode guard(true);
	torch::Device device(torch::kCUDA);
	torch::Tensor img = torch::rand({4, 3, 224, 224}).to(device);
	std::vector<torch::jit::IValue> inputs;
	inputs.push_back(img);
	std::string model_path = argv[1];

	// torch::jit::script::Module model = torch::jit::load(model_path);
	auto model = torch::jit::load(model_path);
	model.to(device);
	if(torch::cuda::is_available()) {
		std::cout << "CUDA now is available ! Inference on GPU." << std::endl;
	}
	
	// warm up
	run_inference(model, inputs);
	
	nvtxRangePushA("MEASURE");
	auto start = std::chrono::high_resolution_clock::now();
	run_inference(model, inputs);
	auto stop = std::chrono::high_resolution_clock::now();
	nvtxRangePop();
	auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start);

	std::cout << "Running time : " << duration.count() << " ms" << std::endl;
	
}


pytorch memory: 740MB

libtorch memory： 2000MB
I was confused...

### Versions

libtorch build-version: 2.0.0+cu118
hardware: RTX 4090Ti

cc @jbschlosser
intermittent inductor segfault in CI  (test_ops.py)
Labels: triaged, bug, oncall: pt2, module: inductor

https://github.com/pytorch/pytorch/actions/runs/4705446491/jobs/8346194860

filing for tracking, appears to be an intermittent issue in trunk.  confirmed retroactively this has been showing up at least for the last week or so, but less than once a day.  so it's probably gonna be hard to find, unless you can get some info from the logs.

cc @ezyang @soumith @msaroufim @ngimel @bdhirsh @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @desertfire
opacus_cifar10 fails in dynamo due to hooks 
Labels: triaged, bug, oncall: pt2, module: dynamo

After adding support for hooks on allowed modules via graph-breaks, opacus_cifar10 crashes during dynamo tracing with

`python benchmarks/dynamo/torchbench.py --only opacus_cifar10 --backend aot_eager --accuracy --inference`

```
 /scratch/whc/work/pytorch/torch/_dynamo/bytecode_analysis.py(190)stacksize_analysis()
-> assert low >= 0
```

It looks like the crash is happening while tracing some exception handling code, relating to hooks on GradSampleModule in opacus.

cc @ezyang @soumith @msaroufim @ngimel @bdhirsh @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @desertfire
Add Debug builds for python with pydebug
Labels: triaged, module: devx

Requested by @albanD:

## The Ask
We need to very seriously consider adding a pydebug CI build. We have major bugs like https://github.com/pytorch/pytorch/pull/91684#issuecomment-1504062950 that keep going unoticed. Dynamo is especially at risk and the cornerstone of PT2.

## pydebug
pydebug is a version of CPython with internal asserts basically. We rely on a lot of low level details in CPython. So we break these asserts regularly for very various reasons


## Installation
More details: https://devguide.python.org/getting-started/setup-building/#unix

Depending on the environment, maybe you will have a package for it. Otherwise you might need to build CPython from source (which we already do anyways) with an extra flag.

## Jobs added
Re the config that should be built, any one config would be file. `linux cpu-only` may be best since it's the cheapest

cc @kit1980 @huydhn @clee2000
TORCH_COMPILE_ABLATE envvar
Labels: low priority, triaged, enhancement, oncall: pt2, module: dynamo

### 🐛 Describe the bug

I propose we add this envvar. Here's what it does:

* `TORCH_COMPILE_ABLATE=inductor`: stop using inductor in all torch.compile calls, if it was being used
* `TORCH_COMPILE_ABLATE=aot`: stop using AOTAutograd in all torch.compile calls, if it was being used. This implies inductor
* anything else people want to add. For example, we could ablate optimizations, etc

You can use this to easily pinpoint if a particular component is causing a problem.

Bikeshedding name is also OK. Other proposal is `TORCH_COMPILE_DISABLE`

### Versions

master

cc @msaroufim @wconstab @bdhirsh @anijain2305 @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov @kadeng @soumith @ngimel @desertfire
No documentation to show how to implement aten::view for custom backend
Labels: module: cpp-extensions, module: docs, triaged

### 📚 The doc issue

The original code is:

```py
  x = torch.empty([1024], device='privateuseone:0')
  y = x.view([2, -1]) # raise error by missing aten::view
```
Then I get following errors:
```txt
NotImplementedError: Could not run 'aten::view' with arguments from the 'PrivateUse1' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'aten::view' is only available for ..
```

According to some interface declaration in Pytorch source code, the extension looks like this:
```cpp
static at::Tensor __view(c10::DispatchKeySet ks, const at::Tensor & self, c10::SymIntArrayRef size) {
  return at::_ops::view::redispatch(ks, self, size);
}
TORCH_LIBRARY_IMPL(aten, Antares, m) {
  m.impl("view", __view);
}
```

However, it results in infinite recursive call of this function and ends with stack overflow.
I don't think `x.view([2, -1])` really requires user to define its implementation. If this definition is a must, what documentation can I refer to get it passed correctly?

### Suggest a potential alternative/fix

An document example of how to implement custom `aten::view`, or any simpler solutions to solve the reshape problem above.

cc @malfet @zou3519 @svekars @carljparker
More Nested Tensor Functionality (layer_norm, cross_entropy / log_softmax&nll_loss)
Labels: triaged, module: nestedtensor, topic: new features

### 🚀 The feature, motivation and pitch

I am working on Graphs. Right now I have a model running that takes a subgraph and does some predictions.
To improve throughput I want to batch multiple subgraphs of different sizes together.
Padding them to the same size does not work in my case as I use an aggregation operation where I don't want to aggregate the padded neighbours but masking some (the padded) neighbours is not possible.

I tried modifiying my model to support nested tensors as input which somewhat worked, but I had to cut out some unsupported operations, specifically layer_norm.
Also currently there are no supported loss functions, so a cross_entropy or nll_loss (and log_softmax) that supports nested tensors would be a big usability upgrade.

Also some error messages related to nested tensors point to [https://github.com/pytorch/nestedtensor](https://github.com/pytorch/nestedtensor) which I suspect is not correct anymore since nested tensors were moved to the core.

### Alternatives

I tried implementing layer_norm myself using the currently supported nested ops, but was not sucessfull.
The issue is the "a/sqrt(b)" calculation, which I did not get to work without a .pow() or element wise division of two nested tensors.

For the loss function I can work around it by unbinding and stacking the output nested tensors, but this is very ugly.

### Additional context

_No response_

cc @cpuhrsch @jbschlosser @bhosmer @drisspg
torch.cuda.is_available() return False
Labels: module: docs, module: cuda, triaged

### 🐛 Describe the bug

![image](https://user-images.githubusercontent.com/61486634/232003058-5027d8b5-1d6f-4fdb-8011-2dbce5d9bc8b.png)


### Versions

![image](https://user-images.githubusercontent.com/61486634/232003083-a96d97bd-22d1-43f2-9422-e9b6a392cdcf.png)
GPU 0: Quadro K620 (UUID: GPU-56622fc6-a9b3-5594-4c6d-b0b231be656a)
python version：3.8.16
cuda version：cuda10.2
cudnn version:8.7.0
![image](https://user-images.githubusercontent.com/61486634/232003168-4aa58152-4b30-436b-949e-ff6a3fd5e84e.png)
torch version：
![image](https://user-images.githubusercontent.com/61486634/232003276-c15165e5-c9e9-4978-9b56-1be6b97e5965.png)


cc @svekars @carljparker @ngimel
DISABLED test_fake_crossref_backward_no_amp_index_fill_cuda_float32 (__main__.TestFakeTensorCUDA)
Labels: triaged, module: flaky-tests, skipped, module: unknown, oncall: pt2, module: fakeTensor

Platforms: linux

This test was disabled because it is failing in CI. See [recent examples](https://hud.pytorch.org/flakytest?name=test_fake_crossref_backward_no_amp_index_fill_cuda_float32&suite=TestFakeTensorCUDA) and the most recent trunk [workflow logs](https://github.com/pytorch/pytorch/runs/12736953983).

Over the past 3 hours, it has been determined flaky in 8 workflow(s) with 8 failures and 8 successes.

**Debugging instructions (after clicking on the recent samples link):**
DO NOT ASSUME THINGS ARE OKAY IF THE CI IS GREEN. We now shield flaky tests from developers so CI will thus be green but it will be harder to parse the logs.
To find relevant log snippets:
1. Click on the workflow logs linked above
2. Click on the Test step of the job so that it is expanded. Otherwise, the grepping will not work.
3. Grep for `test_fake_crossref_backward_no_amp_index_fill_cuda_float32`
4. There should be several instances run (as flaky tests are rerun in CI) from which you can study the logs.


Test file path: `test_ops.py`

cc @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh
Invalid Reference to Class
Labels: oncall: quantization, triaged, topic: docs

### 📚 The doc issue

In this file, https://github.com/pytorch/pytorch/blob/master/torch/ao/quantization/_learnable_fake_quantize.py#L11

`For literature references, please see the class _LearnableFakeQuantizePerTensorOp.` 

`Class _LearnableFakeQuantizePerTensorOp's` implementation is missing in the repo. 

### Suggest a potential alternative/fix

_No response_

cc @jerryzh168 @jianyuh @raghuramank100 @jamesr66a @vkuzo @jgong5 @Xia-Weiwen @leslie-fang-intel
Look into test coverage for `UntypedStorage`
Labels: module: typing, module: tests, triaged

In #94503, there was a mypy error when trying to use `_StorageBase.__setitem__`. Since we don't currently have this mypy error in the main branch, this suggests that `UntypedStorage.__setitem__` is not getting tested anywhere, and a test should be added for it. There might be other tests that `UntypedStorage` is lacking as well

cc @ezyang @malfet @rgommers @xuzhao9 @gramster @mruberry
AttributeError: type object 'torch._C._profiler.ProfilerActivity' has no attribute 'MPS'
Labels: triaged, oncall: profiler, module: mps

### 🚀 The feature, motivation and pitch

Add support for 'MPS' in Pytorch profiler

```
In [1]: import torch

In [2]: from torch.profiler import profile, record_function, ProfilerActivity
   ...: 

In [9]: with profile(activities=[ProfilerActivity.CPU, ProfilerActivity.MPS], re
   ...: cord_shapes=True) as prof:
   ...:     for epoch in range(num_epochs):
   ...:         i = i + 1

```

### Alternatives

_No response_

### Additional context

_No response_

cc @robieta @chaekit @aaronenyeshi @ngimel @nbcsm @guotuofeng @guyang3532 @gaoteng-git @tiffzhaofb @dzhulgakov @davidberard98 @kulinseth @albanD @malfet @DenisVieriu97 @razarmehr @abhudev
Issue on building from source: Remove -mfpu=neon option on MacOS with Apple silicon
Labels: module: build, triaged

### 🐛 Describe the bug

Get pytorch:
```
git clone -b v2.0.0 --recursive https://github.com/pytorch/pytorch
```

Install dependencies as said in Readme.

I tried compiling with bot gcc(real gcc, not alias for clang) and clang, they all told me about -mfpu=neon option.

GCC: 
```
gcc-12: error: unrecognized command-line option '-mfpu=neon'
```

Clang:
```
clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument]
```

This option seems to be useless in this situation.
 

### Versions

pytorch 2.0.0

cc @malfet @seemethere
Is there a way to get the full call stack of pytorch from python to C/C++?
Labels: triaged

### 🚀 The feature, motivation and pitch

I can get the python call stack of pytorch with PYCG or other package. I can get C/C++ call stack with perf. But how to link them together?

Pytorch calls C/C++ functions/operators with dynamic dispatching. It's hard to know what C/C++ functions/operators is called by a pytorch operator ,e.g. bmm operator.

Is there any tools that can profile the call stack or trace from pytorch(up) to C/C++ operators/functions(down)?

### Alternatives

_No response_

### Additional context

_No response_
[BUG]Float32 attention mask not working with torch.autocast("cpu")
Labels: triaged, oncall: transformer/mha

### 🐛 Describe the bug

**Here is a minimal example of the bug, torch==2.0.0**

```
import torch
# torch==2.0.0, cuda=11.7
b = 1
n = 64
d = 256

query = torch.randn(n, b, d)
key = torch.randn(n, b, d)
value = torch.randn(n, b, d)
attn_mask = torch.zeros(n, n)

attention = torch.nn.MultiheadAttention(d, 8)
with torch.no_grad(), torch.autocast("cpu"):
    output = attention(query, key, value, attn_mask=attn_mask, need_weights=False)
```

**RuntimeError: Expected attn_mask dtype to be bool or to match query dtype, but got attn_mask.dtype: float and  query.dtype: c10::BFloat16 instead.**


### Versions

[pip3] numpy==1.23.4
[pip3] open-clip-torch==2.16.0
[pip3] torch==2.0.0
[pip3] torchvision==0.15.1
[pip3] triton==2.0.0
[conda] numpy                     1.23.4                   pypi_0    pypi
[conda] open-clip-torch           2.16.0                   pypi_0    pypi
[conda] torch                     2.0.0                    pypi_0    pypi
[conda] torchvision               0.15.1                   pypi_0    pypi
[conda] triton                    2.0.0                    pypi_0    pypi


cc @jbschlosser @bhosmer @cpuhrsch @erichan1
create_graph_input and add_grapharg should be combined into one function
Labels: triaged, module: dynamo

### 🐛 Describe the bug

@awgu came up with this: https://github.com/pytorch/pytorch/pull/98775#issuecomment-1503293308

It seems to me that the correct invariant is that they should always be called in lockstep. Maybe there is some funny business with constant source but that could be toggled with a kwarg. We should combine these two methods.

### Versions

master

cc @soumith @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @desertfire
[BE] Dedup the functorch skipOps mechanism and the common_method_invocations one
Labels: triaged, module: testing

This code was original in functorch out-of-tree. Then, we [copy-pasted it into PyTorch](https://github.com/pytorch/pytorch/blob/1149ba5553dc3467afed7e1867dffc7065c742c7/torch/testing/_internal/common_methods_invocations.py#L20288-L20321). Since then, there's been a number of improvements to the functorch version and functorch was upstreamed into PyTorch. However, we have not yet consolidated [the functorch version](https://github.com/pytorch/pytorch/blob/master/test/functorch/common_utils.py#L355) with the one in common_method_invocations.

We should consolidate the two, likely just by moving the functorch pieces into common_method_invocations.
Sparse Tensor: in-place operation on detached tensors no longer raised error
Labels: module: sparse, triaged

### 🐛 Describe the bug

According to the [documentation](https://pytorch.org/docs/stable/generated/torch.Tensor.detach.html), in-place operations to detached sparse tensors would raise an error. However, it did not. This has implications for modifying the `.state_dict` (which detaches the tensor by default) in place.

### Versions

[pip3] mypy==1.1.1
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.23.5
[pip3] torch==2.0.0
[pip3] torchaudio==2.0.0
[pip3] torchdata==0.6.0
[pip3] torchelastic==0.2.2
[pip3] torchtext==0.15.0
[pip3] torchvision==0.15.0
[pip3] triton==2.0.0
[conda] blas                      1.0                         mkl  
[conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
[conda] magma-cuda117             2.6.1                         1    pytorch
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-service               2.4.0           py310h7f8727e_0  
[conda] mkl_fft                   1.3.1           py310hd6ae3a3_0  
[conda] mkl_random                1.2.2           py310h00e6091_0  
[conda] numpy                     1.23.5          py310hd5efca6_0  
[conda] numpy-base                1.23.5          py310h8e6c178_0  
[conda] pytorch                   2.0.0           py3.10_cuda11.7_cudnn8.5.0_0    pytorch
[conda] pytorch-cuda              11.7                 h778d358_3    pytorch
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] torchaudio                2.0.0               py310_cu117    pytorch
[conda] torchdata                 0.6.0                     py310    pytorch
[conda] torchelastic              0.2.2                    pypi_0    pypi
[conda] torchtext                 0.15.0                    py310    pytorch
[conda] torchtriton               2.0.0                     py310    pytorch
[conda] torchvision               0.15.0              py310_cu117    pytorch

cc @alexsamardzic @nikitaved @pearu @cpuhrsch @amjames @bhosmer
Please verify 1.14.0 ONNX release candidate on TestPyPI 
Labels: module: onnx, triaged

### 🚀 The feature, motivation and pitch

Hi ONNX partner,
We have released TestPyPI packages of ONNX 1.14.0: https://test.pypi.org/project/onnx/1.14.0rc1/ (ONNX 1.14.0rc1 is the latest version number for testing now).
Please verify it and let us know about any problems. Thank you for your help!

### Alternatives

_No response_

### Additional context

_No response_
Add `torch.cat`  support for torch native sparse tensors. (Need for PyG)
Labels: module: sparse, feature, triaged

### 🚀 The feature, motivation and pitch

Up until recently PyG required torch-sparse which provided functionality for sparse tensor math for GNNs. PyG 2.3+ has the goal of dropping torch-sparse and other legacy torch-* packages that PyG used to require. However, for dropping torch-sparse, we are relying on upstream pytorch native sparse tensors. One required functionality of these tensors is the ability to `torch.cat` them together. Currently this is not supported:
This issue tracks the failure w/ reproduction steps: https://github.com/pytorch/pytorch/issues/98861

### Alternatives

_No response_

### Additional context

_No response_

cc @alexsamardzic @nikitaved @pearu @cpuhrsch @amjames @bhosmer