source:
https://www.cnblogs.com/yifanrensheng/p/12862174.html
https://medium.com/@oleksandrsavsunenko/content-and-style-loss-using-vgg-network-e810a7afe5fc
定义
n维欧式空间中任意k个向量之间两两内积所组成的矩阵,称为这k个向量的格拉姆矩阵(Gram matrix),很明显,这是一个对称矩阵。
计算和特征表示
如果把[channel, h, w]的feature map转换为[channel, h * w]的矩阵,然后与自己的转置矩阵做内积,那么就得到了Gram matrix;由于内积表示两个向量的相关度,所以Gram matrix可以表示自己的特征矩阵中,channel i _i i 和 channel j _j