From 2ab9211b2b148622d7356549a05a528b71914bd7 Mon Sep 17 00:00:00 2001 From: zoeygxy Date: Fri, 23 Aug 2019 13:16:33 +0800 Subject: [PATCH] NDarray remove zero-size output handling --- python/mxnet/ndarray/ndarray.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/python/mxnet/ndarray/ndarray.py b/python/mxnet/ndarray/ndarray.py index 16671b7d191f..6c2bb8078922 100644 --- a/python/mxnet/ndarray/ndarray.py +++ b/python/mxnet/ndarray/ndarray.py @@ -998,18 +998,7 @@ def _get_nd_basic_indexing(self, key): slc_key, self.shape, keep_none=False ) - # handle zero-size outputs - shape = list(self.shape) - i = 0 - zero_size = False - for b, e, s in zip(begin, end, step): # pylint: disable=invalid-name - if b >= e and s > 0 or b <= e and s < 0: - shape[i] = 0 - zero_size = True - i += 1 - if zero_size: - sliced = empty(tuple(shape), dtype=self.dtype, ctx=self.context) - elif self._basic_indexing_slice_is_contiguous(slc_key, self.shape): + if self._basic_indexing_slice_is_contiguous(slc_key, self.shape): # Create a shared-memory view by using low-level flat slicing flat_begin, flat_end = self._basic_indexing_contiguous_flat_begin_end( slc_key, self.shape