Discussion about this post

User's avatar
Prof. Tom Yeh's avatar

pytorch convention uses row vectors for input, so you will need to transpose the math. It's quite confusing, I know. 😉

Boomberg's avatar

I have seen other explanations which use the input X as a bunch of row vectors. And they multiply it from the other side of the matrix to generate Q, K, V. Q = X x Wq, K = X x Wk, V = X x Wv. Which way is actually used in industry code e.g. PyTorch transformers class?

No posts

Ready for more?