Created
August 10, 2016 16:18
-
-
Save fmassa/cb69be37970ce8cbd42e278767017b08 to your computer and use it in GitHub Desktop.
Test script to verify that ResNet101 fits in memory with batch size 64 with latest optnet
This file contains hidden or 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
local optnet = require 'optnet' | |
require 'cudnn' | |
require 'cunn' | |
local createModel = require 'resnet' | |
local opt = {dataset='imagenet', depth=101} | |
local model = createModel(opt) | |
local input = torch.zeros(4,3,224,224):cuda() | |
local grad = torch.zeros(4, 1000):cuda() | |
model:forward(input) | |
model:backward(input, grad) | |
print(optnet.countUsedMemory(model)) | |
optnet.optimizeMemory(model, input, {mode='training', inplace=false}) | |
collectgarbage() | |
collectgarbage() | |
print(optnet.countUsedMemory(model)) | |
input = torch.zeros(64,3,224,224):cuda() | |
grad = torch.zeros(64, 1000):cuda() | |
model:forward(input) | |
model:backward(input, grad) | |
print(optnet.countUsedMemory(model)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment