Last active
September 17, 2015 15:09
-
-
Save etrulls/7d99bbd1f947da62bbf8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cutorch' | |
require 'cunn' | |
-- problem appears with two or more layers | |
model = nn.Sequential() | |
model:add( nn.SpatialConvolution(1,10,3,3) ) | |
model:add( nn.SpatialConvolution(10,20,3,3) ) | |
model:cuda() | |
print( 'This works' ) | |
weights, gradients = model:getParameters() | |
-- convert to float and store | |
copy = model:clone():float() | |
torch.save( 'copy.t7', copy ) | |
-- load and move to GPU | |
stored = torch.load( 'copy.t7' ) | |
stored:cuda() | |
print( 'This crashes' ) | |
weights, gradients = stored:getParameters() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment