luanfujun / deep-painterly-harmonization

Code and data for paper "Deep Painterly Harmonization": https://arxiv.org/abs/1804.03189
6.07k stars 626 forks source link

gradient computation of StyleLoss in neural_gram.lua #16

Open animebing opened 6 years ago

animebing commented 6 years ago

@luanfujun, when I read the code function StyleLoss:updateGradInput in neural_gram.lua, I find maybe there is something wrong about the gradient computation, after

self.gradInput:mul(self.strength)

we should firstly do

self.gradInput:cmul(msk)

and then do

self.gradInput:add(gradOutput)