提交 059433c1 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

merge

...@@ -411,7 +411,10 @@ class ProfileMode(Mode): ...@@ -411,7 +411,10 @@ class ProfileMode(Mode):
apply_time, op_cimpl, message, outputs_size, apply_time, op_cimpl, message, outputs_size,
other_time) other_time)
if outputs_size: if not outputs_size:
print """\nProfile of Theano intermediate memory disabled.
To enabled, put the Theano flag ProfileMode.profile_memory to True."""
else:
fct_memory={}#env->dict(node->(outputs size)) fct_memory={}#env->dict(node->(outputs size))
var_mem = {} var_mem = {}
for node,val in outputs_size.items(): for node,val in outputs_size.items():
...@@ -421,6 +424,7 @@ class ProfileMode(Mode): ...@@ -421,6 +424,7 @@ class ProfileMode(Mode):
var_mem[out]=v var_mem[out]=v
print print
print "Profile of Theano functions memory:" print "Profile of Theano functions memory:"
print "(This check only the output of each apply node. It don't check the temporary memory used by the op in the apply node.)"
nb_skipped = 0 nb_skipped = 0
for env,nodes_mem in fct_memory.iteritems(): for env,nodes_mem in fct_memory.iteritems():
size_sum=sum([sum(val) for key,val in nodes_mem.iteritems()]) size_sum=sum([sum(val) for key,val in nodes_mem.iteritems()])
......
...@@ -10,7 +10,10 @@ ls ${COMPILEDIR}|wc -l ...@@ -10,7 +10,10 @@ ls ${COMPILEDIR}|wc -l
FLAGS=warn.argmax_pushdown_bug=False,warn.gpusum_01_011_0111_bug=False,warn.sum_sum_bug=False,warn.sum_div_dimshuffle_bug=False,compiledir=${COMPILEDIR} FLAGS=warn.argmax_pushdown_bug=False,warn.gpusum_01_011_0111_bug=False,warn.sum_sum_bug=False,warn.sum_div_dimshuffle_bug=False,compiledir=${COMPILEDIR}
export PYTHONPATH=${ROOT_CWD}:$PYTHONPATH export PYTHONPATH=${ROOT_CWD}:$PYTHONPATH
cd ${ROOT_CWD} cd ${ROOT_CWD}/Theano
hg summary
cd ..
echo "executing nosetests with mode=FAST_COMPILE" echo "executing nosetests with mode=FAST_COMPILE"
THEANO_FLAGS=${FLAGS},mode=FAST_COMPILE ${NOSETESTS} Theano THEANO_FLAGS=${FLAGS},mode=FAST_COMPILE ${NOSETESTS} Theano
echo "nb element in the compiledir:" echo "nb element in the compiledir:"
......
...@@ -1126,26 +1126,23 @@ int_div = IntDiv(upcast_out, name = 'int_div') ...@@ -1126,26 +1126,23 @@ int_div = IntDiv(upcast_out, name = 'int_div')
floor_div = int_div floor_div = int_div
def raise_complex_error():
raise ComplexError(
"Theano does not support the mod operator (%) on "
"complex numbers, since numpy deprecated it.")
def mod_check(x, y): def mod_check(x, y):
if (as_scalar(x).type in complex_types or if (as_scalar(x).type in complex_types or
as_scalar(y).type in complex_types): as_scalar(y).type in complex_types):
# Currently forbidden. # Currently forbidden.
raise_complex_error() raise Mod.complex_error
else: else:
return mod(x, y) return mod(x, y)
class Mod(BinaryScalarOp): class Mod(BinaryScalarOp):
complex_error = ComplexError(
"Theano does not support the mod operator (%) on "
"complex numbers, since numpy deprecated it.")
def impl(self, x, y): def impl(self, x, y):
if isinstance(x, numpy.complex) or isinstance(y, numpy.complex): if isinstance(x, numpy.complex) or isinstance(y, numpy.complex):
raise_complex_error() raise self.complex_error
return x % y return x % y
def c_code_cache_version(self): def c_code_cache_version(self):
...@@ -1184,7 +1181,7 @@ class Mod(BinaryScalarOp): ...@@ -1184,7 +1181,7 @@ class Mod(BinaryScalarOp):
x_mod_ypm = "fmod(%(x)s,-%(y)s)"%locals() x_mod_ypm = "fmod(%(x)s,-%(y)s)"%locals()
x_mod_ymp = "fmod(-%(x)s,%(y)s)"%locals() x_mod_ymp = "fmod(-%(x)s,%(y)s)"%locals()
elif str(t) in imap(str, complex_types): elif str(t) in imap(str, complex_types):
raise_complex_error() raise self.complex_error
else: else:
raise NotImplementedError('type not supported', type) raise NotImplementedError('type not supported', type)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论