[NPU]Ensure tensors allocated by empty_like are contiguous (#34935)
This commit is contained in:
@@ -1587,7 +1587,9 @@ class AscendAttnBackend(AttentionBackend):
|
||||
(q.shape[0], layer.tp_q_head_num * layer.v_head_dim)
|
||||
)
|
||||
else:
|
||||
attn_output = torch.empty_like(q)
|
||||
attn_output = torch.empty_like(
|
||||
q, memory_format=torch.contiguous_format
|
||||
)
|
||||
|
||||
use_gqa = layer.tp_q_head_num != layer.tp_k_head_num
|
||||
|
||||
@@ -2746,7 +2748,9 @@ class AscendAttnBackend(AttentionBackend):
|
||||
(q.shape[0], layer.tp_q_head_num * layer.v_head_dim)
|
||||
)
|
||||
else:
|
||||
attn_output = torch.empty_like(q)
|
||||
attn_output = torch.empty_like(
|
||||
q, memory_format=torch.contiguous_format
|
||||
)
|
||||
|
||||
use_gqa = layer.tp_q_head_num != layer.tp_k_head_num
|
||||
|
||||
|
||||
Reference in New Issue
Block a user