attention_vec_mat
vec_mat_wrapper(vec, matrix, output, scaler, softmax_vec, transpose_mat)
¶
Matrix multiplication of a vector and a matrix: Oi = sum_j Vj * Mij If transpose_mat is True, the matrix is transposed: Oi = sum_j Vj * Mji If softmax_vec is True, the vector is softmaxed: Oi = sum_j exp(Vj - max(V)) / sum_k exp(Vk - max(V)) * Mij
@param vec: vector to multiply with the matrix @param matrix: matrix to multiply with the vector @param output: output tensor @param scaler: scaler to multiply the vector with before multiplication @param softmax_vec: whether to softmax the vector before multiplication @param transpose_mat: whether to transpose the matrix before multiplication @return: output tensor