Repository: pytorch
Issue: Submit a bug when trying to assign arg 'out=' in api torch._foreach_add_
Labels: triaged,module: mta,module: python frontend

### 🐛 Describe the bug

When I try to use aten.\_foreach_add.Scalar_out by assign 'out=' in torch.\_foreach_add_ api like this：
```python
import torch
a = torch.randn(1, 3, 4)
c = [1.]
x1 = torch._foreach_add_((a,), c)
print(x1)

x2 = torch._foreach_add_(self=(a,), other=c, out=c)
print(x2)
```
Error occurs:
```
TypeError: foreach_add_(): argument 'self' must be tuple of Tensors, not Tensor.
```
And if I follow the Error and change the param from `(a,)` to `a`, another error occurs：
```python
x2 = torch._foreach_add_(self=a, other=c, out=c)

TypeError: _foreach_add_() received an invalid combination of arguments - got (out=list, other=list, self=Tensor, ), but expected one of:
 * (tuple of Tensors self, Number scalar)
 * (tuple of Tensors self, tuple of Scalars scalars)
 * (tuple of Tensors self, Tensor other, *, Number alpha)
 * (tuple of Tensors self, tuple of Tensors other, *, Number alpha)
```
It seems like ops generated by keyword `autogen` in native_functions.yaml could not  be called by torch api. 

For example, in native_functions.yaml, foreach_add.Scalar_out belongs to keyword `autogen`, and I could not call foreach_add.Scalar_out by torch.foreach_add_ or torch._foreach_add, just like the above error.

Is this a bug and will this be fixed in future version? Thanks a lot
```
- func: _foreach_add_.Scalar(Tensor(a!)[] self, Scalar scalar) -> ()
  device_check: NoCheck   # foreach kernels fall back to slow path when tensor are on different devices
  variants: function
  dispatch:
    CPU: foreach_tensor_add_scalar_kernel_slow_
    CUDA: foreach_tensor_add_scalar_kernel_cuda_
  autogen: _foreach_add.Scalar_out
```

### Versions

PyTorch version: 2.2.0.dev20231208+cu118
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-6ubuntu2) 7.5.0
Clang version: Could not collect
CMake version: version 3.27.1
Libc version: glibc-2.31

Python version: 3.8.17 (default, Jul  5 2023, 21:04:15)  [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.4.0-26-generic-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: 12.1.66
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: NVIDIA A800-SXM4-80GB
GPU 1: NVIDIA A800-SXM4-80GB
GPU 2: NVIDIA A800-SXM4-80GB
GPU 3: NVIDIA A800-SXM4-80GB
GPU 4: NVIDIA A800-SXM4-80GB
GPU 5: NVIDIA A800-SXM4-80GB
GPU 6: NVIDIA A800-SXM4-80GB
GPU 7: NVIDIA A800-SXM4-80GB

Nvidia driver version: 525.105.17
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   46 bits physical, 57 bits virtual
CPU(s):                          112
On-line CPU(s) list:             0-111
Thread(s) per core:              2
Core(s) per socket:              28
Socket(s):                       2
NUMA node(s):                    2
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           106
Model name:                      Intel(R) Xeon(R) Gold 6330 CPU @ 2.00GHz
Stepping:                        6
Frequency boost:                 enabled
CPU MHz:                         899.993
CPU max MHz:                     3100.0000
CPU min MHz:                     800.0000
BogoMIPS:                        4000.00
Virtualization:                  VT-x
L1d cache:                       2.6 MiB
L1i cache:                       1.8 MiB
L2 cache:                        70 MiB
L3 cache:                        84 MiB
NUMA node0 CPU(s):               0-27,56-83
NUMA node1 CPU(s):               28-55,84-111
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Enhanced IBRS, IBPB conditional, RSB filling
Vulnerability Tsx async abort:   Not affected
Flags:                           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 art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 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 invpcid_single ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid md_clear pconfig flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] numpy==1.24.4
[pip3] pytorch-triton==2.1.0+6e4932cda8
[pip3] torch==2.2.0.dev20231208+cu118
[pip3] torchvision==0.17.0.dev20230911+cu118
[pip3] triton==2.1.0
[conda] cudatoolkit               11.8.0               h6a678d5_0    defaults
[conda] numpy                     1.24.4                   pypi_0    pypi
[conda] pytorch-triton            2.1.0+6e4932cda8          pypi_0    pypi
[conda] torch                     2.2.0.dev20231208+cu118          pypi_0    pypi
[conda] torchvision               0.17.0.dev20230911+cu118          pypi_0    pypi
[conda] triton                    2.1.0                    pypi_0    pypi

cc @crcrpar @mcarilli @janeyx99 @albanD