Repository: pytorch
Issue: Cannot add 2 sparse_csc_tensor directly, raising RuntimeError
Labels: module: sparse,triaged

### 🐛 Describe the bug
use cpu:
```python
import torch
a  = torch.tensor([[1, 0], [0, 0]])
a_csc = a.to_sparse_csc()
b = torch.tensor([[1, 1], [0, 0]])
b_csc = b.to_sparse_csc()
c_csc = a_csc + b_csc
```
Error:
```
Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
c_csc = a_csc + b_csc
RuntimeError: crow_indices expected sparse row compressed tensor layout but got SparseCsc
```
use cuda:
```python
import torch
D = torch.device("cuda:0")
a  = torch.tensor([[1, 0], [0, 0]], device=D)
a_csc = a.to_sparse_csc()
b = torch.tensor([[1, 1], [0, 0]], device=D)
b_csc = b.to_sparse_csc()
c_csc = a_csc + b_csc
```
Error:
```
Traceback (most recent call last):
  File "<stdin>", line 7, in <module>
c_csc = a_csc + b_csc
RuntimeError: crow_indices expected sparse row compressed tensor layout but got SparseCsc
```
### Versions

Collecting environment information...
PyTorch version: 2.2.2+cu118
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.6 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: Could not collect
CMake version: version 3.22.4
Libc version: glibc-2.27

Python version: 3.9.19 (main, Mar 21 2024, 17:11:28)  [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.4.0-174-generic-x86_64-with-glibc2.27
Is CUDA available: True
CUDA runtime version: 11.6.124
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3060
Nvidia driver version: 535.146.02
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.4.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.4.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
架构：           x86_64
CPU 运行模式：   32-bit, 64-bit
字节序：         Little Endian
CPU:             32
在线 CPU 列表：  0-31
每个核的线程数： 2
每个座的核数：   16
座：             1
NUMA 节点：      1
厂商 ID：        GenuineIntel
CPU 系列：       6
型号：           79
型号名称：       Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz
步进：           1
CPU MHz：        1200.420
CPU 最大 MHz：   3000.0000
CPU 最小 MHz：   1200.0000
BogoMIPS：       5000.16
虚拟化：         VT-x
L1d 缓存：       32K
L1i 缓存：       32K
L2 缓存：        256K
L3 缓存：        40960K
NUMA 节点0 CPU： 0-31
标记：           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap intel_pt xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts md_clear flush_l1d

Versions of relevant libraries:
[pip3] numpy==1.24.4
[pip3] pytorch-model-summary==0.1.2
[pip3] torch==2.2.2+cu118
[pip3] torchaudio==2.2.2+cu118
[pip3] torchtext==0.17.2
[pip3] torchvision==0.17.2+cu118
[pip3] triton==2.2.0
[conda] numpy                     1.24.4                   pypi_0    pypi
[conda] pytorch-model-summary     0.1.2                    pypi_0    pypi
[conda] torch                     2.2.2+cu118              pypi_0    pypi
[conda] torchaudio                2.2.2+cu118              pypi_0    pypi
[conda] torchtext                 0.17.2                   pypi_0    pypi
[conda] torchvision               0.17.2+cu118             pypi_0    pypi
[conda] triton                    2.2.0                    pypi_0    pypi

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