提交 3073069a authored 作者: Frederic Bastien's avatar Frederic Bastien

Reuse pre-created object

上级 9b81dfc5
......@@ -38,3 +38,4 @@ class NullType(Type):
def __str__(self):
return 'NullType'
null_type = NullType()
......@@ -21,7 +21,7 @@ import theano
from theano import gof
from theano.gof import Variable
from theano.gof.python25 import OrderedDict
from theano.gof.null_type import NullType
from theano.gof.null_type import NullType, null_type
from theano.gof.op import get_debug_values
from theano.compile import ViewOp
......@@ -987,7 +987,7 @@ def _populate_grad_dict(var_to_app_to_idx,
input_grads = []
for connected in inputs_connected:
if connected:
input_grads.append(NullType()())
input_grads.append(null_type())
else:
input_grads.append(disconnected_type())
else:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论