neural_artistic_style icon indicating copy to clipboard operation
neural_artistic_style copied to clipboard

about the method of "update" in the style_network.py file

Open gloddream opened this issue 9 years ago • 1 comments

hi,in paper ,"The derivative of El with respect to the activations in layer l can be computed analytically:" 'grad.jpg'

and this is your git code in method of "update":

    if self.style_weights[l] > 0:
            diff = gram_matrix(x_feats[l]) - self.style_grams[l]
            n_channels = diff.shape[0]
            x_feat = ca.reshape(x_feats[l], (n_channels, -1))
            style_grad = ca.reshape(ca.dot(diff, x_feat), x_feats[l].shape)
            norm = ca.sum(ca.fabs(style_grad))
            weight = float(self.style_weights[l]) / norm
            style_grad *= weight
            grad += style_grad
            loss += 0.25*weight*ca.sum(diff**2)
        grad = layer.bprop(grad)

the question is ,where is the implement of red part which is marked,i can not find the contend code. thanks.

gloddream avatar Sep 30 '16 03:09 gloddream

Hi, I believe the scaling term is incorporated when I precompute the Gram matrix

andersbll avatar Oct 23 '16 10:10 andersbll