def style_loss_pg(self, out_layer, target_style_gram):
# Each input is a 4D tensor: (batch, feature map, height, width)
# TODO: Make the first dim broadcastable instead of tiling
return T.mean(T.sqr(self.batched_gram(out_layer) - T.tile(target_style_gram, (T.shape(out_layer)[0], 1, 1))))
评论列表
文章目录