Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
Fix wrong zero gradient for assignment in direct mode (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartvm authored and alexbw committed Jul 21, 2016
1 parent e13a48a commit 0b3ce31
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/gradfuns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ functions.set = {
return nil
end,
function(g, ans, x, k, v)
return g[k]
local gk = getValue(g[k])
if type(gk) == 'number' then
return gk
else
return torch.clone(gk)
end
end,
}

Expand Down

0 comments on commit 0b3ce31

Please sign in to comment.