mikemwx opened a new pull request #15663: [Numpy] basic slicing in symbolic interface URL: https://github.com/apache/incubator-mxnet/pull/15663 ## Description ## Implement basic slicing in symbolic interface ## 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) - [ ] Changes are complete (i.e. I finished coding on this PR) - [ ] 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) - [ ] 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 - [ ] To my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change ### Changes ### - Add **npx_slice** to support the same kind of slicing in ndarray - Add **npx_reshape** to support reshape with special flags - -1 to infer this dimension from the other given dimensions - -2 copy the current dimension from the input to the output - -3 skip the current dimension if and only if the current dimension is of size 1, report an error otherwise - -4 copy all remaining dimensions from the input to the output - -5 use the product of the next two consecutive dimensions in the output - -6 split current dimension in the output into the next two dimensions in the input - Implement basic slicing in __symbol.py_ : \_\_getitem\_\_, basic slicing means slicing with - an integer - a pyslice - a tuple of integers and pyslices A flag `_output_is_list` is added to symbol class in the frontend to differentiate the cases in which a symbol with only one output Node is conceptually a list, eg: `split(x, 1)` - Overload the `Group` function in Symbol - Overload the `save`, `save_json_string`, `load`, `load_json_string` to specially take care of the newly added flag ## Comments Based on the current implementation, any operator that generates a list-like output should register their name in the list `python/mxnet/base.py:_NP_OUTPUT_IS_LIST_OPERATORS` Thank @reminisce and @haojin2 for reviewing
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
