Browse Source

!15648 [GraphKernel] negative axis in Squeeze expander.

From: @chenlei_autodiff
Reviewed-by: @gaoxiong1,@anyrenwei
Signed-off-by: @anyrenwei
tags/v1.3.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
168c64b60d
1 changed files with 2 additions and 4 deletions
  1. +2
    -4
      mindspore/_extends/graph_kernel/expanders/squeeze.py

+ 2
- 4
mindspore/_extends/graph_kernel/expanders/squeeze.py View File

@@ -34,10 +34,8 @@ class Squeeze(Expander):
if not axis:
out_shape = [d for d in shape if d != 1]
else:
out_shape = []
for idx, dim in enumerate(shape):
if idx not in axis:
out_shape.append(dim)
ndim = len(shape)
out_shape = [shape[i] for i in range(ndim) if not (i in axis or (i - ndim) in axis)]
if not out_shape:
out_shape = [1]
return out_shape


Loading…
Cancel
Save