So, you have output from last layer of encoder, lets name it R_out. In decoder you have two types of attentions, as i said before. Kencdec and Vencdec are used only in Encoder Decoder attention. In this layer you calculate K,Q,V as K = R_out * W_k (this is Kencdec), V = R_out*W_v(this is Vencdec) and Q = X * W_q (X - embedding of target sequence).