提交 87e636be authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Removed a useless comparison

If 'axis' is empty then x.ndim must be equal to zero, and thus we also have 'axis == range(x.ndim)'. If x.ndim in non-zero, there is no reason for axis to be empty, so better not catch this case.
上级 62a49c49
...@@ -1913,7 +1913,7 @@ class MaxAndArgmax(Op): ...@@ -1913,7 +1913,7 @@ class MaxAndArgmax(Op):
def perform(self, node, inp, outs): def perform(self, node, inp, outs):
x, axis = inp x, axis = inp
max, max_idx = outs max, max_idx = outs
if len(axis) == 0 or python_all(axis == range(x.ndim)): if python_all(axis == range(x.ndim)):
axis = None axis = None
max[0] = numpy.asarray(numpy.max(x, axis)) max[0] = numpy.asarray(numpy.max(x, axis))
max_idx[0] = theano._asarray(numpy.argmax(x, axis), dtype='int32') max_idx[0] = theano._asarray(numpy.argmax(x, axis), dtype='int32')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论