leezu edited a comment on issue #11550: NDarray should support __setitem__ with empty key, value URL: https://github.com/apache/incubator-mxnet/issues/11550#issuecomment-402566523 At least `mx.nd.array([])` doesn't raise an error. Also indexing an array to obtain an empty one works. My impression was that NDarray aims to model np.ndarray as close as feasible? Regarding use-case, consider having a list of 1D ndarrays of varying length, with some being empty. Padding them to the same length (and creating a 2D array) following the code above will raise the issue. If mxnet matches the numpy behavior code can be simplified. Otherwise an extra if, else statement needs to be added to handle the special case of empty arrays. For example, consider this Padding function: https://github.com/dmlc/gluon-nlp/blob/8859c20eb97e803f66487c74615350b955efab4a/gluonnlp/data/batchify.py#L63
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
