{"action":"created","issue":{"url":"https://api.github.com/repos/jcjohnson/neural-style/issues/90","labels_url":"https://api.github.com/repos/jcjohnson/neural-style/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/jcjohnson/neural-style/issues/90/comments","events_url":"https://api.github.com/repos/jcjohnson/neural-style/issues/90/events","html_url":"https://github.com/jcjohnson/neural-style/issues/90","id":120867994,"number":90,"title":"StyleLoss dividing by n twice","user":{"login":"rrshaban","id":9829375,"avatar_url":"https://avatars.githubusercontent.com/u/9829375?v=3","gravatar_id":"","url":"https://api.github.com/users/rrshaban","html_url":"https://github.com/rrshaban","followers_url":"https://api.github.com/users/rrshaban/followers","following_url":"https://api.github.com/users/rrshaban/following{/other_user}","gists_url":"https://api.github.com/users/rrshaban/gists{/gist_id}","starred_url":"https://api.github.com/users/rrshaban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrshaban/subscriptions","organizations_url":"https://api.github.com/users/rrshaban/orgs","repos_url":"https://api.github.com/users/rrshaban/repos","events_url":"https://api.github.com/users/rrshaban/events{/privacy}","received_events_url":"https://api.github.com/users/rrshaban/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-07T21:07:54Z","updated_at":"2015-12-11T18:54:58Z","closed_at":"2015-12-11T18:54:58Z","body":"In `StyleLoss:updateOutput` [neural_style.lua:398](https://github.com/jcjohnson/neural-style/blob/master/neural_style.lua#L400):\r\n\r\n```\r\nfunction StyleLoss:updateOutput(input)\r\n  self.G = self.gram:forward(input)\r\n  self.G:div(input:nElement())\r\n  self.loss = self.crit:forward(self.G, self.target)\r\n  ...\r\nend\r\n```\r\n\r\nOur criterion function (`self.crit = nn.MSECriterion()`) already divides by `n` after calculating MSE: [nn.MSECriterion](https://github.com/torch/nn/blob/master/doc/criterion.md#msecriterion). So it seems to me that we are dividing by `n` twice; once before passing it to MSE and then once again within MSE. \r\n\r\nIs this intentional, or am I missing something?"},"comment":{"url":"https://api.github.com/repos/jcjohnson/neural-style/issues/comments/164016969","html_url":"https://github.com/jcjohnson/neural-style/issues/90#issuecomment-164016969","issue_url":"https://api.github.com/repos/jcjohnson/neural-style/issues/90","id":164016969,"user":{"login":"rrshaban","id":9829375,"avatar_url":"https://avatars.githubusercontent.com/u/9829375?v=3","gravatar_id":"","url":"https://api.github.com/users/rrshaban","html_url":"https://github.com/rrshaban","followers_url":"https://api.github.com/users/rrshaban/followers","following_url":"https://api.github.com/users/rrshaban/following{/other_user}","gists_url":"https://api.github.com/users/rrshaban/gists{/gist_id}","starred_url":"https://api.github.com/users/rrshaban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrshaban/subscriptions","organizations_url":"https://api.github.com/users/rrshaban/orgs","repos_url":"https://api.github.com/users/rrshaban/repos","events_url":"https://api.github.com/users/rrshaban/events{/privacy}","received_events_url":"https://api.github.com/users/rrshaban/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T18:54:58Z","updated_at":"2015-12-11T18:54:58Z","body":"Thanks for the detailed reply, as well as the great code!"}}