提交 08e88ec5 authored 作者: Frederic Bastien's avatar Frederic Bastien

Small speed up.

上级 78164b96
...@@ -367,15 +367,15 @@ class FunctionGraph(utils.object2): ...@@ -367,15 +367,15 @@ class FunctionGraph(utils.object2):
reason reason
reason is the name of the optimization or operation in progress. reason is the name of the optimization or operation in progress.
""" """
global NullType
if NullType is None:
from .null_type import NullType
# Imports the owners of the variables # Imports the owners of the variables
if variable.owner and variable.owner not in self.apply_nodes: if variable.owner and variable.owner not in self.apply_nodes:
self.__import__(variable.owner, reason=reason) self.__import__(variable.owner, reason=reason)
if (variable.owner is None and elif (variable.owner is None and
not isinstance(variable, graph.Constant) and not isinstance(variable, graph.Constant) and
variable not in self.inputs): variable not in self.inputs):
global NullType
if NullType is None:
from .null_type import NullType
if isinstance(variable.type, NullType): if isinstance(variable.type, NullType):
raise TypeError("Computation graph contains a NaN. " + raise TypeError("Computation graph contains a NaN. " +
variable.type.why_null) variable.type.why_null)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论