Skip to content

Commit

Permalink
Training: Only convert to cuda in cuda mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Amos committed Jun 13, 2016
1 parent f4567e8 commit c04386c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions training/train.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ function train()
torch.save(paths.concat(opt.save, 'model_' .. epoch .. '.t7'), model)
torch.save(paths.concat(opt.save, 'optimState_' .. epoch .. '.t7'), optimState)

model = model:cuda()
if opt.cudnn then
cudnn.convert(model, cudnn)
if opt.cuda then
model = model:cuda()
if opt.cudnn then
cudnn.convert(model, cudnn)
end
end
collectgarbage()
end -- of train()
Expand Down

0 comments on commit c04386c

Please sign in to comment.