pytorch/c10
Nikita Shulga 71caac2b30 [MPSInductor] Add rand support (#145705)
Using Philox4 as PRNG

Test plan (other that CI)
Run
```python
mport torch
from torch._inductor.utils import run_and_get_code
from contextlib import nullcontext

def foo(x):
   return x * torch.randn_like(x)

foo_c = torch.compile(foo)

x = torch.ones(100, 100, device="mps")

y = foo_c(x)

print(y.mean().item(), y.std().item())
for i in range(25):
  print(y[i].mean(), y[i].std())
```
And observe that printed values are close to 0 and 1

TODO: Better `randint` algorithm for large ranges

Pull Request resolved: https://github.com/pytorch/pytorch/pull/145705
Approved by: https://github.com/dcci, https://github.com/jansel
2025-01-27 06:07:36 +00:00
..
benchmark
core [autocast][pytorch] Support autocast for MTIA (#145627) 2025-01-25 03:24:59 +00:00
cuda Set RUNPATH on CUDA and XPU tests (#144305) 2025-01-26 08:40:22 +00:00
hip
macros [ROCm][Windows] Fix export macros (#144098) 2025-01-04 17:12:46 +00:00
metal [MPSInductor] Add rand support (#145705) 2025-01-27 06:07:36 +00:00
mobile
test c10::string_view -> std::string_view in pytorch (#143591) 2025-01-13 21:44:05 +00:00
util Fix PythonMod printing for C++ (#143385) 2025-01-22 14:58:35 +00:00
xpu Set RUNPATH on CUDA and XPU tests (#144305) 2025-01-26 08:40:22 +00:00
BUCK.oss
BUILD.bazel
build.bzl
CMakeLists.txt
ovrsource_defs.bzl