def _to_texture_feature(self, layers):
"""
:param layers: predicted value of each layer
:type layers: List[chainer.Variable]
"""
subvectors = []
for layer_index in range(len(layers)):
layer = layers[layer_index]
beta = numpy.sqrt(numpy.float32(self.model.beta[layer_index]) / len(layers))
texture_matrix = float(beta) * neural_art.utility.get_matrix(layer)
texture_matrix /= numpy.sqrt(numpy.prod(texture_matrix.data.shape)) # normalize
subvector = chainer.functions.reshape(texture_matrix, (numpy.prod(texture_matrix.data.shape),))
subvectors.append(subvector)
return chainer.functions.concat(subvectors, axis=0)
image_converter.py 文件源码
python
阅读 16
收藏 0
点赞 0
评论 0
评论列表
文章目录