Skip to content

Commit b4d378f

Browse files
committed
Fix: init range
1 parent 17e41cb commit b4d378f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

problems/nvidia/nvfp4_dual_gemm/reference.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ def generate_input(
112112

113113
# Generate uint8 tensor, then convert to float4e2m1fn_x2 data type
114114
a_ref = torch.randint(
115-
0, 2, (l, m, k // 2), dtype=torch.int8, device="cuda"
115+
0, 4, (l, m, k // 2), dtype=torch.int8, device="cuda"
116116
).permute(1, 2, 0)
117117
b1_ref = torch.randint(
118-
0, 2, (l, n, k // 2), dtype=torch.int8, device="cuda"
118+
0, 4, (l, n, k // 2), dtype=torch.int8, device="cuda"
119119
).permute(1, 2, 0)
120120
b2_ref = torch.randint(
121-
0, 2, (l, n, k // 2), dtype=torch.int8, device="cuda"
121+
0, 4, (l, n, k // 2), dtype=torch.int8, device="cuda"
122122
).permute(1, 2, 0)
123123
a_ref = a_ref.view(torch.float4_e2m1fn_x2)
124124
b1_ref = b1_ref.view(torch.float4_e2m1fn_x2)
@@ -137,7 +137,7 @@ def create_scale_factor_tensors(l, mn, sf_k):
137137
ref_shape = (l, mn, sf_k)
138138
ref_permute_order = (1, 2, 0)
139139
# Init with uint8 tensor, then convert to float8_e4m3fn
140-
ref_f8_random_int = torch.randint(-1, 2, ref_shape, dtype=torch.int8, device='cuda')
140+
ref_f8_random_int = torch.randint(0, 3, ref_shape, dtype=torch.int8, device='cuda')
141141
ref_f8_torch_tensor = ref_f8_random_int.to(dtype=torch.float8_e4m3fn)
142142
# permute to match ref_permute_order
143143
ref_f8_torch_tensor_permuted = ref_f8_torch_tensor.permute(*ref_permute_order)

0 commit comments

Comments
 (0)