!3072 fix InvertPermutation error msg

Merge pull request !3072 from jiangjinsheng/issue_fix4
This commit is contained in:
mindspore-ci-bot 2020-07-15 14:12:35 +08:00 committed by Gitee
commit 30bcd0a1fe
1 changed files with 2 additions and 1 deletions

View File

@ -1018,7 +1018,8 @@ class InvertPermutation(PrimitiveWithInfer):
raise ValueError(f'For \'{self.name}\' the input value must be non-Tensor.') raise ValueError(f'For \'{self.name}\' the input value must be non-Tensor.')
for shp in x_shp: for shp in x_shp:
if shp != []: if shp != []:
raise ValueError(f'For \'{self.name}\' the rank of input must be 1.') x_rank = len(np.array(x_value, np.int64).shape)
raise ValueError(f'For \'{self.name}\' the rank of input must be 1, but got {x_rank}.')
for i, value in enumerate(x_value): for i, value in enumerate(x_value):
validator.check_value_type("input[%d]" % i, value, [int], self.name) validator.check_value_type("input[%d]" % i, value, [int], self.name)
z = [x_value[i] for i in range(len(x_value))] z = [x_value[i] for i in range(len(x_value))]