From 24dc0925db3f0f1a5128604f971886b8f6c79791 Mon Sep 17 00:00:00 2001 From: buxue Date: Fri, 8 Jan 2021 15:10:56 +0800 Subject: [PATCH] fix bug in getitem when index is True --- mindspore/common/tensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mindspore/common/tensor.py b/mindspore/common/tensor.py index 679b334ed6..2add3237ce 100644 --- a/mindspore/common/tensor.py +++ b/mindspore/common/tensor.py @@ -191,7 +191,7 @@ class Tensor(Tensor_): return out def __getitem__(self, index): - if isinstance(index, int) and self.shape and index >= self.shape[0]: + if isinstance(index, int) and not isinstance(index, bool) and self.shape and index >= self.shape[0]: raise IndexError("index {} is out of bounds for axis 0 with size {}".format(index, self.shape[0])) out = tensor_operator_registry.get('__getitem__')(self, index) return out