提交 3acf57cb authored 作者: Frederic Bastien's avatar Frederic Bastien

Postpone Composite name creating. It seem to spend a great deal of time there…

Postpone Composite name creating. It seem to spend a great deal of time there inside the local_fusion opt
上级 3e024c1f
......@@ -3462,6 +3462,8 @@ class Composite(ScalarOp):
init_param = ('inputs', 'outputs')
def __str__(self):
if self.name is None:
self.init_name()
return self.name
def make_new_inplace(self, output_types_preference=None, name=None):
......@@ -3476,7 +3478,7 @@ class Composite(ScalarOp):
if name:
out.name = name
else:
name = out.name
name = getattr(out,'name', None)
super(Composite, out).__init__(output_types_preference, name)
return out
......@@ -3558,6 +3560,8 @@ class Composite(ScalarOp):
"""
try:
rval = self.name
if rval is None:
raise AttributeError
except AttributeError:
if 0:
l = []
......@@ -3642,7 +3646,10 @@ class Composite(ScalarOp):
self.nin = len(inputs)
self.nout = len(outputs)
self.init_fgraph() # self.fgraph
self.init_name() # self.name
# Postpone the creation in case it isn't needed.
# self.init_name() # self.name
self.name = None
self.init_c_code() # self._c_code and self.nodenames
self.init_py_impls() # self._impls
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论