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 2020/01/21 23:32:21 UTC

[GitHub] [incubator-mxnet] szhengac opened a new pull request #17400: [MXNET-#16167] Refactor Optimizer

szhengac opened a new pull request #17400: [MXNET-#16167] Refactor Optimizer
URL: https://github.com/apache/incubator-mxnet/pull/17400
 
 
   ## Description ##
   Refactor optimizers for MxNet 2.0:
   
   Main change: 
   1. Base class `Optimizer` and `Updater` are split into two files.
   2. Each optimizer has its own file. 
   3. To improve readability, each optimizer has two functions: `step` and `fused_step`. Pure ndarray implementation is put in function `step` while `fused_step` contains using optimized kernel. Using `step` or `fused_step` is controlled using flag `use_fused_step`. The main reason to have two step functions is that it is hard for an optimization researcher to implement a new optimizer if he refers to the existing implementations such as SGD. In pytorch, they only use pure python code in optim. So I consider providing two update functions to maintain both readability and efficiency.
   4. `update`, `update_multi_precision`, `step`, and `fused_step` take as input `indices, weights, grads, states`, where the length of the list is determined by `aggregate_num`. When `aggregate_num = numpy.inf`, all the parameters are aggregated. This change is necessary if we wants to implement some complex optimizers such as LBFGS and Barzilai-Borwein Step Size, which require access to all the parameters in a single function.
   5. Fix weight decay inconsistency #9881. Now, it is consistent with Pytorch and Tensorflow.
   6. Clean C++ implementation so that it is consistent with Python code. It is found that a small difference in implementation can lead to a precision difference of 1e-3. 
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [x] 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 https://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
   - [x] To the best of my knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change
   
   ### Changes ###
   - [x] Feature1, tests, (and when applicable, API doc)
   - [x] Feature2, tests, (and when applicable, API doc)
   
   ## Comments ##
   - If this change is a backward incompatible change, why must this change be made.
   - Interesting edge cases to note here
   
   @szha @eric-haibin-lin @sxjscience @leezu 
   

----------------------------------------------------------------
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

[GitHub] [incubator-mxnet] sxjscience merged pull request #17400: [MXNET-#16167] Refactor Optimizer

Posted by GitBox <gi...@apache.org>.
sxjscience merged pull request #17400: [MXNET-#16167] Refactor Optimizer
URL: https://github.com/apache/incubator-mxnet/pull/17400
 
 
   

----------------------------------------------------------------
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