提交 fdb4028d authored 作者: Frederic's avatar Frederic

Fix code revice comments and add a message.

上级 57a65772
......@@ -626,7 +626,7 @@ class ProfileStats(object):
v = out.type.get_size(sh)
sum_dense += v
else:
v = "Unknow"
v = "Unknown"
var_mem[out] = v
fct_memory[node.fgraph][node].append(v)
......@@ -778,12 +778,16 @@ class ProfileStats(object):
else:
p = "(%.2f%%)" % (float(sum_remaining) / size_sum_dense * 100)
print >> file, (
' ... (remaining %i Apply account for %4dB/%dB (%s) of'
' the Apply with dense outputs sizes)') % (max(0, len(node_mem) - N),
' ... (remaining %i Apply account for %4dB/%dB (%s) of the'
' Apply with dense outputs sizes)') % (max(0, len(node_mem) - N),
sum_remaining,
size_sum_dense, p
)
print >> file, ''
if N == 0:
print >> file, (' All Apply node have outputs size that take'
' less then %dB.' %
config.profiling.min_memory_size)
print >> file, (
" <created/inplace/view> is taked from the op declaration.")
print >> file, (" Apply nodes marked 'inplace' or 'view' may"
......
......@@ -421,7 +421,10 @@ class CudaNdarrayType(Type):
return obj.shape
def get_size(self, shape_info):
return numpy.prod(shape_info, dtype=int) * numpy.dtype(self.dtype).itemsize
if shape_info:
return numpy.prod(shape_info) * numpy.dtype(self.dtype).itemsize
else: # a scalar
return numpy.dtype(self.dtype).itemsize
theano.compile.ops.expandable_types += (CudaNdarrayType,)
......
......@@ -1209,8 +1209,10 @@ class TensorType(Type):
:return: the number of bytes taken by the object described in
shape_info.
"""
return numpy.prod(shape_info,
dtype=int) * numpy.dtype(self.dtype).itemsize
if shape_info:
return numpy.prod(shape_info) * numpy.dtype(self.dtype).itemsize
else: # a scalar
return numpy.dtype(self.dtype).itemsize
theano.compile.ops.expandable_types += (TensorType,)
# Register TensorType C code for ViewOp.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论