提交 6de8aec7 authored 作者: khaotik's avatar khaotik

use (...) for multiine string

上级 8453f1f0
...@@ -1201,24 +1201,24 @@ def _populate_grad_dict(var_to_app_to_idx, ...@@ -1201,24 +1201,24 @@ def _populate_grad_dict(var_to_app_to_idx,
is_zero = _is_zero(term) is_zero = _is_zero(term)
assert is_zero in ['yes', 'no', 'maybe'] assert is_zero in ['yes', 'no', 'maybe']
if is_zero == 'maybe': if is_zero == 'maybe':
msg = "%s.grad returned %s of type %s for input" \ msg = ("%s.grad returned %s of type %s for input"
" %d. This input's only connections to " \ " %d. This input's only connections to "
"the cost through this op are via " \ "the cost through this op are via "
"integer-valued outputs so it should be " \ "integer-valued outputs so it should be "
"NullType, DisconnectedType, or some form " \ "NullType, DisconnectedType, or some form "
"of zeros. It is not NullType or " \ "of zeros. It is not NullType or "
"DisconnectedType and theano can't " \ "DisconnectedType and theano can't "
"simplify it to a constant, so it's not " \ "simplify it to a constant, so it's not "
"verifiably zeros." "verifiably zeros.")
msg %= (node.op, term, type(term), i) msg %= (node.op, term, type(term), i)
elif is_zero == 'no': elif is_zero == 'no':
msg = "%s.grad returned %s of type %s for input" \ msg = ("%s.grad returned %s of type %s for input"
" %d. Since this input is only connected " \ " %d. Since this input is only connected "
"to integer-valued outputs, it should " \ "to integer-valued outputs, it should "
"evaluate to zeros, but it evaluates to" \ "evaluate to zeros, but it evaluates to"
"%s." "%s.")
msg %= (node.op, term, type(term), i, msg %= (node.op, term, type(term), i,
theano.get_scalar_constant_value(term)) theano.get_scalar_constant_value(term))
...@@ -1240,24 +1240,23 @@ def _populate_grad_dict(var_to_app_to_idx, ...@@ -1240,24 +1240,23 @@ def _populate_grad_dict(var_to_app_to_idx,
ov.type, DisconnectedType) ov.type, DisconnectedType)
if actually_connected and not connected: if actually_connected and not connected:
msg = "%s.grad returned %s of type %s for input %d." \ msg = ("%s.grad returned %s of type %s for input %d."
" Expected DisconnectedType instance based on " \ " Expected DisconnectedType instance based on "
" the output of the op's connection_pattern " \ " the output of the op's connection_pattern "
"method." "method.")
msg %= (str(node.op), str(ig), str(ig.type), i) msg %= (str(node.op), str(ig), str(ig.type), i)
raise TypeError(msg) raise TypeError(msg)
elif connected and not actually_connected: elif connected and not actually_connected:
msg = "%s.grad returned DisconnectedType for input" \ msg = "%s.grad returned DisconnectedType for input %d."
" %d." msg %= (str(node.op), i)
msg = msg % (str(node.op), i)
if hasattr(node.op, 'connection_pattern'): if hasattr(node.op, 'connection_pattern'):
msg += ' Its connection_pattern method does not' \ msg += (' Its connection_pattern method does not'
' allow this.' ' allow this.')
raise TypeError(msg) raise TypeError(msg)
else: else:
msg += ' You may want to implement a ' \ msg += (' You may want to implement a '
'connection_pattern method for it.' 'connection_pattern method for it.')
warnings.warn(msg) warnings.warn(msg)
# cache the result # cache the result
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论