提交 dbc3e752 authored 作者: Frederic Bastien's avatar Frederic Bastien

give a warning if we use a numpy version that have a memory leak and that we…

give a warning if we use a numpy version that have a memory leak and that we exeecute code that will hit that leak.
上级 14561051
......@@ -131,6 +131,7 @@ class mrg_uniform_base(Op):
self.inplace=inplace
if inplace:
self.destroy_map = {0:[0]}
self.warned_numpy_version = False
def __eq__(self, other):
return type(self) == type(other) \
......@@ -161,6 +162,11 @@ class mrg_uniform(mrg_uniform_base):
return op(rstate, cast(v_size, 'int32'))
def perform(self, node, (rstate, size), (o_rstate, o_sample)):
numpy_version=numpy.__version__.split('.')
if not self.warned_numpy_version and int(numpy_version[0])<=1 and int(numpy_version[1])<3:
print "Warning: you must use numpy version 1.3.0 or higher with the python version of this op. Otherwise numpy leak memory. and numpy"
self.warned_numpy_version = True
n_elements = 1
rstate = numpy.asarray(rstate) # bring state from GPU if necessary
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论