提交 bd233bec authored 作者: Olivier Delalleau's avatar Olivier Delalleau

PEP8 fixes

上级 347ec9eb
...@@ -221,7 +221,7 @@ class Apply(Node): ...@@ -221,7 +221,7 @@ class Apply(Node):
return new_node return new_node
def get_parents(self): def get_parents(self):
return list( self.inputs ) return list(self.inputs)
#convenience properties #convenience properties
nin = property(lambda self: len(self.inputs), doc='same as len(self.inputs)') nin = property(lambda self: len(self.inputs), doc='same as len(self.inputs)')
...@@ -387,8 +387,8 @@ class Variable(Node): ...@@ -387,8 +387,8 @@ class Variable(Node):
def get_parents(self): def get_parents(self):
if self.owner is not None: if self.owner is not None:
return [ self.owner ] return [self.owner]
return [ ] return []
def env_getter(self): def env_getter(self):
warnings.warn("Variable.env is deprecated, it has been renamed 'fgraph'", warnings.warn("Variable.env is deprecated, it has been renamed 'fgraph'",
...@@ -405,8 +405,7 @@ class Variable(Node): ...@@ -405,8 +405,7 @@ class Variable(Node):
stacklevel=2) stacklevel=2)
del self.fgraph del self.fgraph
def eval(self, inputs_to_values=None):
def eval(self, inputs_to_values = None):
""" Evaluates this variable. """ Evaluates this variable.
inputs_to_values: a dictionary mapping theano Variables to values. inputs_to_values: a dictionary mapping theano Variables to values.
...@@ -418,13 +417,12 @@ class Variable(Node): ...@@ -418,13 +417,12 @@ class Variable(Node):
if not hasattr(self, '_fn'): if not hasattr(self, '_fn'):
self._fn_inputs = inputs_to_values.keys() self._fn_inputs = inputs_to_values.keys()
self._fn = theano.function(self._fn_inputs, self) self._fn = theano.function(self._fn_inputs, self)
args = [ inputs_to_values[param] for param in self._fn_inputs ] args = [inputs_to_values[param] for param in self._fn_inputs]
rval = self._fn(*args) rval = self._fn(*args)
return rval return rval
env = property(env_getter, env_setter, env_deleter) env = property(env_getter, env_setter, env_deleter)
...@@ -1030,6 +1028,7 @@ def view_roots(r): ...@@ -1030,6 +1028,7 @@ def view_roots(r):
else: else:
return [r] return [r]
def list_of_nodes(inputs, outputs): def list_of_nodes(inputs, outputs):
""" Return the apply nodes of the graph between inputs and outputs """ """ Return the apply nodes of the graph between inputs and outputs """
return stack_search( return stack_search(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论