Scaled_dot_product_attention shape error

i have this error Incompatible shapes: [3,4] vs. [2] [Op:RealDiv]


help !

Hi @MohamedSalah ,

Your dk contains the dimensions of the keys matrix, k. To get the scale, you need to get the number of rows in k:
dk = np.shape(k)[0]

1 Like