Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gloddream opened this issue Sep 30, 2016 · 1 comment
Open

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

gloddream opened this issue Sep 30, 2016 · 1 comment

Comments

@gloddream
Copy link

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.

@andersbll
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants