提交 13bf5618 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Typo fixes and replaced an error with a warning

This is to be consistent with the idea that "on_shape_error=warn" is supposed to be a warning, not an error. NB: I verified that the warning is displayed on screen by default.
上级 87d0ddc3
...@@ -786,9 +786,10 @@ class ShapeFeature(object): ...@@ -786,9 +786,10 @@ class ShapeFeature(object):
self.shape_of[r] = s self.shape_of[r] = s
else: else:
if r.ndim != len(s): if r.ndim != len(s):
raise ShapeError("Something infered a shape with %d dimensions" raise ShapeError(
" for a variable with %d dimensions." % ( "Something inferred a shape with %d dimensions "
len(s), r.ndim)) "for a variable with %d dimensions." % (
len(s), r.ndim))
shape_vars = [self.unpack(s_i) for s_i in s] shape_vars = [self.unpack(s_i) for s_i in s]
self.shape_of[r] = tuple(shape_vars) self.shape_of[r] = tuple(shape_vars)
...@@ -919,7 +920,7 @@ class ShapeFeature(object): ...@@ -919,7 +920,7 @@ class ShapeFeature(object):
'supported, and one should now use tensor.ShapeError ' 'supported, and one should now use tensor.ShapeError '
'instead. The original exception message is: %s' % e) 'instead. The original exception message is: %s' % e)
except Exception, e: except Exception, e:
msg = ('Failed to infer_shape from Op %s.\nInput shapes:' msg = ('Failed to infer_shape from Op %s.\nInput shapes: '
'%s\nException encountered during infer_shape: ' '%s\nException encountered during infer_shape: '
'%s\nException message: %s\nTraceback: %s') % ( '%s\nException message: %s\nTraceback: %s') % (
node.op, [self.shape_of[r] for r in node.inputs], node.op, [self.shape_of[r] for r in node.inputs],
...@@ -927,7 +928,7 @@ class ShapeFeature(object): ...@@ -927,7 +928,7 @@ class ShapeFeature(object):
if config.on_shape_error == "raise": if config.on_shape_error == "raise":
raise Exception(msg) raise Exception(msg)
else: else:
_logger.error(msg) _logger.warning(msg)
o_shapes = self.default_infer_shape( o_shapes = self.default_infer_shape(
node, [self.shape_of[r] for r in node.inputs]) node, [self.shape_of[r] for r in node.inputs])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论