提交 9a5c5861 authored 作者: Frederic Bastien's avatar Frederic Bastien

fix MaxAndArgMax to work when the axis is not a constant.

上级 9dac94ad
...@@ -1329,7 +1329,7 @@ class MaxAndArgmax(Op): ...@@ -1329,7 +1329,7 @@ class MaxAndArgmax(Op):
#we make the axis all positive to make the infer_shape work with negative axis #we make the axis all positive to make the infer_shape work with negative axis
if x.type.ndim>0: if x.type.ndim>0:
for id,a in enumerate(axis): for id,a in enumerate(axis):
if a<0: if not isinstance(a, TensorVariable) and a<0:
if -a>x.type.ndim: if -a>x.type.ndim:
raise ValueError('axis out of range') raise ValueError('axis out of range')
axis[id]=x.type.ndim+a axis[id]=x.type.ndim+a
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论