fix backward for when query and key have different contiguity (#818)

This commit is contained in:
Brian Hirsh 2024-02-10 04:01:27 -05:00 committed by GitHub
parent 4687936413
commit 2423cca3ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -830,7 +830,7 @@ mha_bwd(const at::Tensor &dout, // batch_size x seqlen_q x num_heads, x head_si
TORCH_CHECK(dv.stride(-1) == 1, "dv must have contiguous last dimension");
CHECK_SHAPE(dv, batch_size, seqlen_k, num_heads_k, head_size);
} else {
dv = torch::empty_like(k);
dv = torch::empty_like(v);
}
at::Tensor dout_padded;