Skip to content

Commit a9cefab

Browse files
committed
Replace torch.rand with torch.randn
1 parent f3a8db1 commit a9cefab

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

add.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
dtype = torch.float16
1212
device = "cuda"
1313

14-
input = torch.rand(size, dtype=dtype, device=device)
15-
other = torch.rand(size, dtype=dtype, device=device)
14+
input = torch.randn(size, dtype=dtype, device=device)
15+
other = torch.randn(size, dtype=dtype, device=device)
1616

1717
ninetoothed_output = ops.ninetoothed.torch.add(input, other)
1818
torch_output = input + other

swiglu.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ def torch_swiglu(
2020
dtype = torch.float16
2121
device = "cuda"
2222

23-
a = torch.rand(shape, dtype=dtype, device=device)
24-
b = torch.rand(shape, dtype=dtype, device=device)
25-
c = torch.rand(shape, dtype=dtype, device=device)
23+
a = torch.randn(shape, dtype=dtype, device=device)
24+
b = torch.randn(shape, dtype=dtype, device=device)
25+
c = torch.randn(shape, dtype=dtype, device=device)
2626

2727
ninetoothed_output = ops.ninetoothed.torch.swiglu(a, b)
2828
torch_output = torch_swiglu(a, b)
@@ -58,8 +58,8 @@ def torch_swiglu(
5858
def benchmark(m, n, provider):
5959
shape = (m, n)
6060

61-
a = torch.rand(shape, dtype=dtype, device=device)
62-
b = torch.rand(shape, dtype=dtype, device=device)
61+
a = torch.randn(shape, dtype=dtype, device=device)
62+
b = torch.randn(shape, dtype=dtype, device=device)
6363

6464
if provider == "ninetoothed":
6565
ms = triton.testing.do_bench(lambda: ops.ninetoothed.torch.swiglu(a, b))

0 commit comments

Comments
 (0)