Browse Source

fix the bug of ellipsis dim-size confusion and the ErrorType

tags/v1.2.0-rc1
Payne 5 years ago
parent
commit
c3eb913a9b
2 changed files with 3 additions and 2 deletions
  1. +1
    -0
      mindspore/ops/composite/multitype_ops/_compile_utils.py
  2. +2
    -2
      mindspore/ops/composite/multitype_ops/_constexpr_utils.py

+ 1
- 0
mindspore/ops/composite/multitype_ops/_compile_utils.py View File

@@ -365,6 +365,7 @@ def tensor_index_by_tuple(data, tuple_index):
"""Tensor getitem by tuple of various types with None"""
if len(tuple_index) == 1:
return data[tuple_index[0]]
tuple_index = _transform_ellipsis_to_slice(tuple_index, data, const_utils.TENSOR_GETITEM)
indexes_types = hyper_map(F.typeof, tuple_index)
contain_type = const_utils.tuple_index_type_cnt(indexes_types, const_utils.TENSOR_GETITEM)
if contain_type == const_utils.ALL_TENSOR:


+ 2
- 2
mindspore/ops/composite/multitype_ops/_constexpr_utils.py View File

@@ -776,8 +776,8 @@ def separate_mixed_tensors_index(indexes_types, op_name):
elif isinstance(ele_type, mstype.ellipsis_type):
ellipsis_position = i
else:
raise TypeError(f"For '{op_name}', the index elements only support "
f"'Tensor', 'int32', 'int64', 'Slice', 'Ellipsis', but got {ele_type}.")
raise IndexError(f"For '{op_name}', the index elements only support "
f"'Tensor', 'int32', 'int64', 'Slice', 'Ellipsis', but got {ele_type}.")

return tensor_positions, slice_positions, ellipsis_position



Loading…
Cancel
Save