Grouping the multiple query heads of MultiHeadAttention into subgroups of query heads and assigning each…