From 6dd71c19a7fa629c5fb1a64dbe78cc655b9b3588 Mon Sep 17 00:00:00 2001 From: Adam Kropp <30504149+akropp@users.noreply.github.com> Date: Thu, 2 Nov 2023 09:45:22 -0400 Subject: [PATCH] Update src/mlpack/methods/ann/layer/multihead_attention_impl.hpp Co-authored-by: Ryan Curtin --- src/mlpack/methods/ann/layer/multihead_attention_impl.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/multihead_attention_impl.hpp b/src/mlpack/methods/ann/layer/multihead_attention_impl.hpp index 733fe7d247..33f14d4c89 100644 --- a/src/mlpack/methods/ann/layer/multihead_attention_impl.hpp +++ b/src/mlpack/methods/ann/layer/multihead_attention_impl.hpp @@ -333,7 +333,9 @@ Gradient(const MatType& input, if (selfAttention && tgtSeqLen != srcSeqLen) { - Log::Fatal << "Incorrect input dimensions for selfAttention!" << std::endl; + Log::Fatal << "Target sequence length (" << tgtSeqLen << ") and source " + << "sequence length (" << srcSeqLen << ") must match when using " + << "self-attention!" << std::endl; } if (error.n_rows != tgtSeqLen * embedDim)