Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
NDarray remove zero-size output handling
Browse files Browse the repository at this point in the history
  • Loading branch information
zoeygxy committed Aug 23, 2019
1 parent a1b6ec5 commit 2ab9211
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions python/mxnet/ndarray/ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2ab9211

Please sign in to comment.