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

PEP8 fixes

上级 1fca63be
...@@ -167,7 +167,8 @@ def scan(fn, ...@@ -167,7 +167,8 @@ def scan(fn,
# ^ initial state but taps not provided # ^ initial state but taps not provided
if 'taps' in outs_info[i]: if 'taps' in outs_info[i]:
# ^ explicitly provided a None for taps # ^ explicitly provided a None for taps
_logger.warning('Output %s ( index %d) has a memory ' _logger.warning(
'Output %s (index %d) has a memory '
'buffer but taps is explicitly set to None ', 'buffer but taps is explicitly set to None ',
getattr(outs_info[i]['membuf'], 'name', 'None'), getattr(outs_info[i]['membuf'], 'name', 'None'),
i) i)
...@@ -213,7 +214,7 @@ def scan(fn, ...@@ -213,7 +214,7 @@ def scan(fn,
nw_slice = _seq_val_slice.type() nw_slice = _seq_val_slice.type()
if seq.name: if seq.name:
nw_slice.name=seq.name + '[t]' nw_slice.name = seq.name + '[t]'
scan_seqs.append(_seq_val) scan_seqs.append(_seq_val)
inner_seqs.append(nw_slice) inner_seqs.append(nw_slice)
inner_slices.append(actual_slice) inner_slices.append(actual_slice)
...@@ -354,7 +355,6 @@ def scan(fn, ...@@ -354,7 +355,6 @@ def scan(fn,
else: else:
pass pass
# Re-order args # Re-order args
max_mit_sot = numpy.max([-1] + mit_sot_rightOrder) + 1 max_mit_sot = numpy.max([-1] + mit_sot_rightOrder) + 1
max_sit_sot = numpy.max([-1] + sit_sot_rightOrder) + 1 max_sit_sot = numpy.max([-1] + sit_sot_rightOrder) + 1
...@@ -401,7 +401,8 @@ def scan(fn, ...@@ -401,7 +401,8 @@ def scan(fn,
# when we apply the lambda expression we get a mixture of update rules # when we apply the lambda expression we get a mixture of update rules
# and outputs that needs to be separated # and outputs that needs to be separated
lambda_result = fn(*args) lambda_result = fn(*args)
condition, outputs, updates = scan_utils.get_updates_and_outputs(lambda_result) condition, outputs, updates = scan_utils.get_updates_and_outputs(
lambda_result)
if condition is not None: if condition is not None:
as_while = True as_while = True
else: else:
......
...@@ -16,7 +16,8 @@ logger = logging.getLogger('theano.updates') ...@@ -16,7 +16,8 @@ logger = logging.getLogger('theano.updates')
import warnings import warnings
# Must be an OrderedDict or updates will be applied in a non-deterministic order # Must be an OrderedDict or updates will be applied in a non-deterministic
# order.
class OrderedUpdates(OrderedDict): class OrderedUpdates(OrderedDict):
""" """
Dict-like mapping from SharedVariable keys to their new values. Dict-like mapping from SharedVariable keys to their new values.
...@@ -49,8 +50,8 @@ class OrderedUpdates(OrderedDict): ...@@ -49,8 +50,8 @@ class OrderedUpdates(OrderedDict):
return super(OrderedUpdates, self).__setitem__(key, value) return super(OrderedUpdates, self).__setitem__(key, value)
else: else:
raise TypeError('OrderedUpdates keys must inherit from SharedVariable', raise TypeError('OrderedUpdates keys must inherit from '
key) 'SharedVariable', key)
def update(self, other=None): def update(self, other=None):
if other is None: if other is None:
...@@ -78,6 +79,7 @@ class OrderedUpdates(OrderedDict): ...@@ -78,6 +79,7 @@ class OrderedUpdates(OrderedDict):
rval.update(self) rval.update(self)
return rval return rval
def Updates(*key, **kwargs): def Updates(*key, **kwargs):
warnings.warn("Updates is deprecated. Switch to OrderedUpdates.") warnings.warn("Updates is deprecated. Switch to OrderedUpdates.")
return OrderedUpdates(*key, **kwargs) return OrderedUpdates(*key, **kwargs)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论