Given attention weights and pair of key/value, how to calculate query?

I mean pytorch default multi head attention layer.