Last active
August 29, 2015 14:24
-
-
Save ebenolson/ae0330a36f0ae4e7949b 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
import numpy as np | |
import gc | |
import memory_profiler | |
import theano | |
import theano.tensor as T | |
from theano.sandbox.cuda.dnn import dnn_conv | |
X = T.tensor4() | |
W = T.tensor4() | |
f = theano.function([X, W], dnn_conv(X, W)) | |
X0 = np.zeros((1, 1, 5, 5)).astype('float32') | |
W0 = np.zeros((1, 1, 5, 5)).astype('float32') | |
gc.collect() | |
gc.collect() | |
gc.collect() | |
mem0 = memory_profiler.memory_usage(-1)[0] | |
for _ in range(100): | |
for _ in range(1000): | |
_ = f(X0, W0) | |
gc.collect() | |
gc.collect() | |
gc.collect() | |
mem = memory_profiler.memory_usage(-1)[0] | |
print(mem - mem0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output: