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

fix ProfileMode of memory for type that don't have a size attribute like mtrand.RandomState.

上级 7f30bedd
...@@ -104,6 +104,12 @@ class ProfileMode(Mode): ...@@ -104,6 +104,12 @@ class ProfileMode(Mode):
dt = time.time() - t0 dt = time.time() - t0
size=[] size=[]
for o in th.outputs: for o in th.outputs:
if not hasattr(o[0],'size'):
#if the output type don't have a size attribute, set -1
#to signify we can't evaluate it.
#This happen at least for mtrand.RandomState type(in numpy)
size.append(-1)
continue
s=o[0].size s=o[0].size
#can't use o[0].dtype.itemsize as dtype is a str for CudaNdarray #can't use o[0].dtype.itemsize as dtype is a str for CudaNdarray
dtype = str(o[0].dtype) dtype = str(o[0].dtype)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论