[Fix] Use torch.empty for output in attention+quant fusion (#31785)
Signed-off-by: elvischenv <219235043+elvischenv@users.noreply.github.com>
This commit is contained in:
@@ -170,9 +170,8 @@ class AttentionFp8StaticQuantPattern(AttentionQuantPattern):
|
|||||||
kv_cache_dummy_dep: torch.Tensor,
|
kv_cache_dummy_dep: torch.Tensor,
|
||||||
) -> torch.Tensor:
|
) -> torch.Tensor:
|
||||||
# attn output in quant_dtype
|
# attn output in quant_dtype
|
||||||
output_attn = torch.ops.aten.full.default(
|
output_attn = torch.empty(
|
||||||
[q.shape[0], self.num_heads, self.head_size],
|
[q.shape[0], self.num_heads, self.head_size],
|
||||||
0.0,
|
|
||||||
dtype=self.quant_dtype,
|
dtype=self.quant_dtype,
|
||||||
device=q.device,
|
device=q.device,
|
||||||
)
|
)
|
||||||
@@ -271,9 +270,8 @@ class AttentionNvfp4QuantPattern(AttentionQuantPattern):
|
|||||||
kv_cache_dummy_dep: torch.Tensor,
|
kv_cache_dummy_dep: torch.Tensor,
|
||||||
) -> tuple[torch.Tensor, torch.Tensor]:
|
) -> tuple[torch.Tensor, torch.Tensor]:
|
||||||
# attention output in quant_dtype
|
# attention output in quant_dtype
|
||||||
output_attn = torch.ops.aten.full.default(
|
output_attn = torch.empty(
|
||||||
[q.shape[0], self.num_heads, self.head_size // 2],
|
[q.shape[0], self.num_heads, self.head_size // 2],
|
||||||
0.0,
|
|
||||||
dtype=self.quant_dtype,
|
dtype=self.quant_dtype,
|
||||||
device=q.device,
|
device=q.device,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user