def dot(self, X, Y, name='dot_op'): with tf.name_scope(name) as scope: dot_op = tf.diag_part(tf.matmul(X, Y, transpose_b=True)) return dot_op