Repository: pytorch
Issue: [prims] torch.ops.aten.le decomposition confuses scalars and tensors
Labels: triaged,module: primTorch

### 🐛 Describe the bug

Running
```python
from torch import nn
import torch
from torch._decomp import get_decompositions
from torch.fx.experimental.proxy_tensor import make_fx
from torch._functorch.compile_utils import strip_overloads

class Model(nn.Module):
    def forward(self, x):
        return torch.ops.aten.le(x, 0)

model = Model()

arg = torch.ones([4])
model(arg)
print("JIT script on original model")
torch.jit.script(model)


fx_g = make_fx(
           model,
           decomposition_table=get_decompositions([torch.ops.aten.le]))(arg)

# shows: le = torch.ops.prims.le.default(arg0_1, 0.0);
print(fx_g.code)
fx_g(arg)
strip_overloads(fx_g)

print("JIT script on decomposed fx graph:")

torch.jit.script(fx_g) # ERROR is produced here
```
shows the error
```
JIT script on original model



def forward(self, arg0_1):
    le = torch.ops.prims.le.default(arg0_1, 0.0);  arg0_1 = None
    return le
    
JIT script on decomposed fx graph:
.venv-3.10/lib/python3.10/site-packages/torch/jit/_check.py:172: UserWarning: The TorchScript type system doesn't support instance-level annotations on empty non-base types in `__init__`. Instead, either 1) use a type annotation in the class body, or 2) wrap the type in `torch.jit.Attribute`.
  warnings.warn("The TorchScript type system doesn't support "
Traceback (most recent call last):
  File "repro_decomp_le.py", line 41, in <module>
    torch.jit.script(fx_g)
  File ".venv-3.10/lib/python3.10/site-packages/torch/jit/_script.py", line 1284, in script
    return torch.jit._recursive.create_script_module(
  File ".venv-3.10/lib/python3.10/site-packages/torch/jit/_recursive.py", line 480, in create_script_module
    return create_script_module_impl(nn_module, concrete_type, stubs_fn)
  File ".venv-3.10/lib/python3.10/site-packages/torch/jit/_recursive.py", line 546, in create_script_module_impl
    create_methods_and_properties_from_stubs(concrete_type, method_stubs, property_stubs)
  File ".venv-3.10/lib/python3.10/site-packages/torch/jit/_recursive.py", line 397, in create_methods_and_properties_from_stubs
    concrete_type._create_methods_and_properties(property_defs, property_rcbs, method_defs, method_rcbs, method_defaults)
RuntimeError: 

prims::le(Tensor self, Tensor other) -> Tensor:
Expected a value of type 'Tensor' for argument 'other' but instead found type 'float'.
:
  File "<eval_with_key>.1", line 5
def forward(self, arg0_1):
    le = torch.ops.prims.le(arg0_1, 0.0);  arg0_1 = None
         ~~~~~~~~~~~~~~~~~~ <--- HERE
    return le
```

### Versions

PyTorch version: 2.1.0.dev20230526+cpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.2 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
Clang version: 15.0.7
CMake version: version 3.26.3
Libc version: glibc-2.35

Python version: 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] (64-bit runtime)
Python platform: Linux-4.15.0-166-generic-x86_64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Address sizes:                   48 bits physical, 48 bits virtual
Byte Order:                      Little Endian
CPU(s):                          16
On-line CPU(s) list:             0-15
Vendor ID:                       AuthenticAMD
Model name:                      AMD EPYC Processor
CPU family:                      23
Model:                           1
Thread(s) per core:              1
Core(s) per socket:              8
Socket(s):                       2
Stepping:                        2
BogoMIPS:                        5988.74
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm rep_good nopl xtopology cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 virt_ssbd arat
Hypervisor vendor:               KVM
Virtualization type:             full
L1d cache:                       512 KiB (16 instances)
L1i cache:                       1 MiB (16 instances)
L2 cache:                        8 MiB (16 instances)
L3 cache:                        16 MiB (2 instances)
NUMA node(s):                    1
NUMA node0 CPU(s):               0-15
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; Full AMD retpoline, IBPB conditional, STIBP disabled, RSB filling
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected

Versions of relevant libraries:
[pip3] numpy==1.24.3
[pip3] pytorch-quantization==2.1.2
[pip3] torch==2.1.0.dev20230526+cpu
[pip3] torchvision==0.16.0.dev20230526+cpu
[conda] Could not collect

cc @ezyang @mruberry @ngimel @Lezcano @peterbell10