提交 4d92c2b2 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Fixed some tests

Tests expect a ValueError when an invalid axis is provided to max and co.
上级 4a167629
......@@ -1904,6 +1904,13 @@ class MaxAndArgmax(Op):
else:
axis = _as_tensor_variable(axis)
# Verify that the axis is valid.
for ax in axis.data:
if ax < 0 or ax >= x.type.ndim:
raise ValueError(
'Invalid axis: %s (the number of dimensions of the '
'input is: %s)' % (axis, x.type.ndim))
inputs = [x, axis]
broadcastable = [False] * (x.type.ndim - len(axis.data))
outputs = [tensor(x.type.dtype, broadcastable, name='max'),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论