import tensorflow as tf
h_doc=tf.placeholder(tf.int32,[None,30,512])
h_query=tf.placeholder(tf.int32,[None,10,512])
temp = tf.matmul(h_doc, h_query, adjoint_b = True) # tf.batch_matmul(h_doc, h_query, adj_y=True)

(?, 30, 10)