Skip to content

Instantly share code, notes, and snippets.

@szagoruyko
Created February 7, 2016 22:47
Show Gist options
  • Save szagoruyko/2831b1ab990bb24ade14 to your computer and use it in GitHub Desktop.
Save szagoruyko/2831b1ab990bb24ade14 to your computer and use it in GitHub Desktop.
ts = {
model = net,
unpack = function(self)
for k,v in ipairs(self.model:listModules()) do
if v.weight and not v.gradWeight then
v.gradWeight = v.weight:clone()
v.gradBias = v.bias:clone()
end
end
return self.model
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment