From e2134b31d391874b36967be90f3bd813b70544cc Mon Sep 17 00:00:00 2001 From: jiangjinsheng Date: Fri, 22 May 2020 16:24:22 +0800 Subject: [PATCH] fixed InvertPermutation --- mindspore/ops/operations/array_ops.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mindspore/ops/operations/array_ops.py b/mindspore/ops/operations/array_ops.py index 45e04b83f..43025876b 100644 --- a/mindspore/ops/operations/array_ops.py +++ b/mindspore/ops/operations/array_ops.py @@ -926,7 +926,11 @@ class InvertPermutation(PrimitiveWithInfer): def __infer__(self, x): x_shp = x['shape'] x_value = x['value'] - validator.check_value_type("shape", x_shp, [tuple], self.name) + validator.check_value_type("shape", x_shp, [tuple, list], self.name) + if mstype.issubclass_(x['dtype'], mstype.tensor): + validator.check('x dimension', len(x_shp), '', 1, Rel.EQ, self.name) + validator.check_type_same({'x dtype': x['dtype']}, mstype.int_type, self.name) + x_value = [int(i) for i in x_value.asnumpy()] z = [x_value[i] for i in range(len(x_value))] z.sort() -- GitLab