diff --git a/mindspore/parallel/_auto_parallel_context.py b/mindspore/parallel/_auto_parallel_context.py index 6efa65815b..91e3189d2e 100644 --- a/mindspore/parallel/_auto_parallel_context.py +++ b/mindspore/parallel/_auto_parallel_context.py @@ -274,6 +274,9 @@ class _AutoParallelContext: TypeError: If group is not a python str. """ self.check_context_handle() + if not indices: + raise ValueError('indices can not be empty') + if isinstance(indices, (list)): for index in indices: if not isinstance(index, int):