Fix: torch.zeros doesn't support Float4_e2m1fn_x2 dtype
Allocate as uint8 then view as float4_e2m1fn_x2 for padding buffer.
This commit is contained in:
@@ -58,7 +58,8 @@ def _cutedsl_nvfp4_linear(
|
||||
padded_rows = cutedsl_ceil_div(num_tokens, 128) * 128
|
||||
if num_tokens < padded_rows:
|
||||
x_fp4_padded = torch.zeros(padded_rows, x_fp4.shape[1],
|
||||
dtype=x_fp4.dtype, device=x.device)
|
||||
dtype=torch.uint8, device=x.device
|
||||
).view(torch.float4_e2m1fn_x2)
|
||||
x_fp4_padded[:num_tokens] = x_fp4
|
||||
else:
|
||||
x_fp4_padded = x_fp4
|
||||
|
||||
Reference in New Issue
Block a user