Python utils 模块,gram_matrix() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用utils.gram_matrix()

项目:A-Neural-Algorithm-of-Artistic-Style    作者:kbedi95    | 项目源码 | 文件源码
def style_gram_matrices(self):

        gram_matrices = []

        for style_layer in config["style_layers"]:

            # Get the activations of the given style image at the given style layer
            style_activation = utils.get_layer_activations(session=self.evaluation_sess, graph=self.evaluation_g,
                                                           layer_name=style_layer, input_layer_name=self.input_tensor,
                                                           input=self.style_image)

            # Construct the gram matrix from the activations and save the matrix to the gram_matrices array
            gram_matrices.append(utils.gram_matrix(style_activation).astype(np.float32))

        return gram_matrices