You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/05/29 07:02:48 UTC

[GitHub] [incubator-mxnet] reminisce opened a new pull request #15090: Loosen the constraint on serializing/deserializing ndarrays in np_shape semantics

reminisce opened a new pull request #15090: Loosen the constraint on serializing/deserializing ndarrays in np_shape semantics
URL: https://github.com/apache/incubator-mxnet/pull/15090
 
 
   ## Description ##
   `np_shape` semantics was introduced to support future NumPy operators where scalar tensors and zero-size tensors are common to see. Due to the concern on the potential issues of backward compatibility when this semantics is enabled, such as different handling on scalar tensors w/ or w/o this semantics, [serializing/deserializing was simply marked as unsupported](https://github.com/apache/incubator-mxnet/blob/5fc4fc53df74f276aafa51208142e657e9cfe42d/src/ndarray/ndarray.cc#L1585) when this semantics is enabled.
   
   At the moment, [DGL](https://www.dgl.ai/) developers want to enable this semantics in their work to support zero-size tensors. Simply disabling serializing/deserializing ndarrays of all types: dense, sparse, zero-size, and scalars would make their unit tests fail in `np_shape` semantics.
   
   After careful consideration, we decided to loosen the constraint to support serialization/deserialization in the semantics of `np_shape` for ndarrays satisfying ALL the following three conditions as it would be the same as handling future NumPy ndarrays.
   1. The storage type MUST be default type, i.e. this is a dense ndarray.
   2. The ndarray CANNOT be a zero-size ndarray, i.e. with shape like `(2, 0, 3)`.
   3. The ndarray CANNOT be a scalar ndarray, i.e. with shape `()`.
   
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [ ] The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant [JIRA issue](https://issues.apache.org/jira/projects/MXNET/issues) created (except PRs with tiny changes)
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [x] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
   - [x] Code is well-documented: 
   - For user-facing API changes, API doc string has been updated. 
   - For new C++ functions in header files, their functionalities and arguments are documented. 
   - For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
   - Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
   - [x] To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services