[GitHub] [incubator-mxnet] anirudh2290 commented on issue #14451: fix custom operation in fork
anirudh2290 commented on issue #14451: fix custom operation in fork URL: https://github.com/apache/incubator-mxnet/pull/14451#issuecomment-474219677 @arcadiaphy yes I don't see other option apart from depending on libpython if we have to fix these issues w.r.t custom op. What do others think ? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] arcadiaphy edited a comment on issue #14451: fix custom operation in fork
arcadiaphy edited a comment on issue #14451: fix custom operation in fork URL: https://github.com/apache/incubator-mxnet/pull/14451#issuecomment-474181960 @anirudh2290 The program blocks because of GIL. According to the following docs in your link, if fork locks GIL, then acquiring GIL in another thread and join them will cause deadlock. > Another important thing to note about threads is their behaviour in the face of the C fork() call. On most systems with fork(), after a process forks only the thread that issued the fork will exist. That also means any locks held by other threads will never be released. Python solves this for os.fork() by acquiring the locks it uses internally before the fork, and releasing them afterwards. In addition, it resets any Lock Objects in the child. When extending or embedding Python, there is no way to inform Python of additional (non-Python) locks that need to be acquired before or reset after a fork. OS facilities such as pthread_atfork() would need to be used to accomplish the same thing. Additionally, when extending or embedding Python, calling fork() directly rather than through os.fork() (and returning to or calling into Python) may result in a deadlock by one of Python’s internal locks being held by a thread that is defunct after the fork. PyOS_AfterFork_Child() tries to reset the necessary locks, but is not always able to. Additional handling should be added to correctly run callbacks: ``` #include #include #include #include #include "./lib.h" callback *fun_python; void set_python_callback(callback *func) { fun_python = func; } class Foo { public: Foo() { pthread_atfork([]() { // call fun_python successfully std::cout << fun_python(5) << std::endl; // call fun_python failed in thread Py_BEGIN_ALLOW_THREADS std::thread t([]() { std::cout << fun_python(10) << std::endl;}); t.join(); Py_END_ALLOW_THREADS }, NULL, NULL); } }; static Foo f; ``` But adding this will make mxnet link against libpython, do we really want to do this? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] arcadiaphy edited a comment on issue #14451: fix custom operation in fork
arcadiaphy edited a comment on issue #14451: fix custom operation in fork URL: https://github.com/apache/incubator-mxnet/pull/14451#issuecomment-474181960 @anirudh2290 The program blocks because of GIL. According to the following docs in your link, if fork locks GIL, then acquiring GIL in another thread will cause deadlock. > Another important thing to note about threads is their behaviour in the face of the C fork() call. On most systems with fork(), after a process forks only the thread that issued the fork will exist. That also means any locks held by other threads will never be released. Python solves this for os.fork() by acquiring the locks it uses internally before the fork, and releasing them afterwards. In addition, it resets any Lock Objects in the child. When extending or embedding Python, there is no way to inform Python of additional (non-Python) locks that need to be acquired before or reset after a fork. OS facilities such as pthread_atfork() would need to be used to accomplish the same thing. Additionally, when extending or embedding Python, calling fork() directly rather than through os.fork() (and returning to or calling into Python) may result in a deadlock by one of Python’s internal locks being held by a thread that is defunct after the fork. PyOS_AfterFork_Child() tries to reset the necessary locks, but is not always able to. Additional handling should be added to correctly run callbacks: ``` #include #include #include #include #include "./lib.h" callback *fun_python; void set_python_callback(callback *func) { fun_python = func; } class Foo { public: Foo() { pthread_atfork([]() { // call fun_python successfully std::cout << fun_python(5) << std::endl; // call fun_python failed in thread Py_BEGIN_ALLOW_THREADS std::thread t([]() { std::cout << fun_python(10) << std::endl;}); t.join(); Py_END_ALLOW_THREADS }, NULL, NULL); } }; static Foo f; ``` But adding this will make mxnet link against libpython, do we really want to do this? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] anirudh2290 commented on a change in pull request #14277: Enhance PartitionGraph
anirudh2290 commented on a change in pull request #14277: Enhance PartitionGraph URL: https://github.com/apache/incubator-mxnet/pull/14277#discussion_r266743453 ## File path: src/operator/subgraph/subgraph_property.h ## @@ -200,7 +197,7 @@ typedef dmlc::ThreadLocalStore__REGISTER_OR_GET__(#Name, &SubgraphPropertyType::Create) +SubgraphPropertyRegistry::Get()->__REGISTER__(#Name, &SubgraphPropertyType::Create) Review comment: I think I am okay with the REGISTER only in cc limitation as long as it is well documented here: http://mxnet.incubator.apache.org/versions/master/tutorials/c++/subgraphAPI.html?highlight=subgraph#subgraph-api . Also, we need to make sure that we call Create only once for each property even for this use case: ``` MXNET_REGISTER_SUBGRAPH_PROPERTY(default, DefaultSubgraphProperty) MXNET_REGISTER_SUBGRAPH_PROPERTY(default, DefaultSubgraphProperty) ``` This can be done by adding a map of subgraph property name to the corresponding subgraph property pointer. For this passing the property name along with the create fn is required when calling __REGISTER__. The create gets called and returned subgraph property ptr gets added in __REGISTER__ itself. We can then reuse the already added subgraph property ptr in CreateSubgraphProperty. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] chinakook commented on issue #14421: Updating mxnet from 1.0.0, networks give different outputs
chinakook commented on issue #14421: Updating mxnet from 1.0.0, networks give different outputs URL: https://github.com/apache/incubator-mxnet/issues/14421#issuecomment-474207449 How do you use your model to inference? If you are using mx.module, please make sure the parameter for_training is set to be 0. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] chinakook edited a comment on issue #14459: Cannot release memory sometimes
chinakook edited a comment on issue #14459: Cannot release memory sometimes URL: https://github.com/apache/incubator-mxnet/issues/14459#issuecomment-474205117 Please repeat Ctrl-C until you get back to the console. However, if your GPU is set to persistent mode, Ctrl-C cannot clear the memory. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] chinakook commented on issue #14459: Cannot release memory sometimes
chinakook commented on issue #14459: Cannot release memory sometimes URL: https://github.com/apache/incubator-mxnet/issues/14459#issuecomment-474205117 Please repeat Ctrl-C until you get back to the console. 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: us...@infra.apache.org With regards, Apache Git Services
[incubator-mxnet] branch master updated: [Doc] Start the tutorials for MKL-DNN backend (#14202)
This is an automated email from the ASF dual-hosted git repository. patriczhao pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git The following commit(s) were added to refs/heads/master by this push: new c56c146 [Doc] Start the tutorials for MKL-DNN backend (#14202) c56c146 is described below commit c56c14658daa650090377501d01e2606f4702e1e Author: Tao Lv AuthorDate: Tue Mar 19 13:36:06 2019 +0800 [Doc] Start the tutorials for MKL-DNN backend (#14202) * start tutorials for mkldnn backend * fix links * add to tutorial index * fix sanity test * fix sanity test complain * add to webpage * Hint message and avoid 404 --- MKLDNN_README.md | 314 + NEWS.md| 2 +- README.md | 2 +- docs/faq/perf.md | 2 +- docs/install/ubuntu_setup.md | 2 +- docs/install/windows_setup.md | 4 +- docs/tutorials/index.md| 2 + .../tutorials/mkldnn/MKLDNN_README.md | 6 +- docs/tutorials/mkldnn/index.md | 25 ++ tests/tutorials/test_sanity_tutorials.py | 2 + 10 files changed, 39 insertions(+), 322 deletions(-) diff --git a/MKLDNN_README.md b/MKLDNN_README.md index 214fc83..34790c9 100644 --- a/MKLDNN_README.md +++ b/MKLDNN_README.md @@ -15,316 +15,4 @@ -# Build/Install MXNet with MKL-DNN - -A better training and inference performance is expected to be achieved on Intel-Architecture CPUs with MXNet built with [Intel MKL-DNN](https://github.com/intel/mkl-dnn) on multiple operating system, including Linux, Windows and MacOS. -In the following sections, you will find build instructions for MXNet with Intel MKL-DNN on Linux, MacOS and Windows. - -The detailed performance data collected on Intel Xeon CPU with MXNet built with Intel MKL-DNN can be found [here](https://mxnet.incubator.apache.org/faq/perf.html#intel-cpu). - - -Contents - -* [1. Linux](#1) -* [2. MacOS](#2) -* [3. Windows](#3) -* [4. Verify MXNet with python](#4) -* [5. Enable MKL BLAS](#5) -* [6. Enable graph optimization](#6) -* [7. Quantization](#7) -* [8. Support](#8) - -Linux - -### Prerequisites - -``` -sudo apt-get update -sudo apt-get install -y build-essential git -sudo apt-get install -y libopenblas-dev liblapack-dev -sudo apt-get install -y libopencv-dev -sudo apt-get install -y graphviz -``` - -### Clone MXNet sources - -``` -git clone --recursive https://github.com/apache/incubator-mxnet.git -cd incubator-mxnet -``` - -### Build MXNet with MKL-DNN - -``` -make -j $(nproc) USE_OPENCV=1 USE_MKLDNN=1 USE_BLAS=mkl USE_INTEL_PATH=/opt/intel -``` - -If you don't have the full [MKL](https://software.intel.com/en-us/intel-mkl) library installation, you might use OpenBLAS as the blas library, by setting USE_BLAS=openblas. - -MacOS - -### Prerequisites - -Install the dependencies, required for MXNet, with the following commands: - -- [Homebrew](https://brew.sh/) -- llvm (clang in macOS does not support OpenMP) -- OpenCV (for computer vision operations) - -``` -# Paste this command in Mac terminal to install Homebrew -/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - -# install dependency -brew update -brew install pkg-config -brew install graphviz -brew tap homebrew/core -brew install opencv -brew tap homebrew/versions -brew install llvm -``` - -### Clone MXNet sources - -``` -git clone --recursive https://github.com/apache/incubator-mxnet.git -cd incubator-mxnet -``` - -### Build MXNet with MKL-DNN - -``` -LIBRARY_PATH=$(brew --prefix llvm)/lib/ make -j $(sysctl -n hw.ncpu) CC=$(brew --prefix llvm)/bin/clang CXX=$(brew --prefix llvm)/bin/clang++ USE_OPENCV=1 USE_OPENMP=1 USE_MKLDNN=1 USE_BLAS=apple USE_PROFILER=1 -``` - -Windows - -On Windows, you can use [Micrsoft Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/) and [Microsoft Visual Studio 2017](https://www.visualstudio.com/downloads/) to compile MXNet with Intel MKL-DNN. -[Micrsoft Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/) is recommended. - -**Visual Studio 2015** - -To build and install MXNet yourself, you need the following dependencies. Install the required dependencies: - -1. If [Microsoft Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/) is not already installed, download and install it. You can download and install the free community edition. -2. Download and Install [CMake 3](https://cmake.org/) if it is not already installed. -3. Download and install [OpenCV 3](http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0/opencv-3.0.0.exe/download). -4. Unzip the OpenCV package. -5. Set the environment variable ```OpenCV_DIR``` to
[GitHub] [incubator-mxnet] pengzhao-intel commented on issue #14202: [Doc] Start the tutorials for MKL-DNN backend
pengzhao-intel commented on issue #14202: [Doc] Start the tutorials for MKL-DNN backend URL: https://github.com/apache/incubator-mxnet/pull/14202#issuecomment-474204607 Thanks, @aaronmarkham I am merging now :) 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] pengzhao-intel merged pull request #14202: [Doc] Start the tutorials for MKL-DNN backend
pengzhao-intel merged pull request #14202: [Doc] Start the tutorials for MKL-DNN backend URL: https://github.com/apache/incubator-mxnet/pull/14202 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] pengzhao-intel commented on issue #14399: [Doc] Improve the document for MKL-DNN backend
pengzhao-intel commented on issue #14399: [Doc] Improve the document for MKL-DNN backend URL: https://github.com/apache/incubator-mxnet/issues/14399#issuecomment-474204315 @yinghu5 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] aaronmarkham commented on issue #14202: [Doc] Start the tutorials for MKL-DNN backend
aaronmarkham commented on issue #14202: [Doc] Start the tutorials for MKL-DNN backend URL: https://github.com/apache/incubator-mxnet/pull/14202#issuecomment-474204129 I think the separate issue to track the docs needs is great! Go ahead with this one. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] arcadiaphy edited a comment on issue #14451: fix custom operation in fork
arcadiaphy edited a comment on issue #14451: fix custom operation in fork URL: https://github.com/apache/incubator-mxnet/pull/14451#issuecomment-47410 @YutingZhang The problem you mentioned may be related to GIL, correctly handling GIL in c++ extension is a tricky problem, easy to cause deadlock. Now we have no such handling at all. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] pengzhao-intel commented on issue #14202: [Doc] Start the tutorials for MKL-DNN backend
pengzhao-intel commented on issue #14202: [Doc] Start the tutorials for MKL-DNN backend URL: https://github.com/apache/incubator-mxnet/pull/14202#issuecomment-474202565 @aaronmarkham do you have any other suggestion for our plan? We're working on improving the MKLDNN documents. If this is no other comment, I will merge this PR in 24 hours as the first step of doc enhancement. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] ciyongch closed pull request #14407: Update imagenet quantization script for MKL-DNN
ciyongch closed pull request #14407: Update imagenet quantization script for MKL-DNN URL: https://github.com/apache/incubator-mxnet/pull/14407 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] ciyongch commented on issue #14407: Update imagenet quantization script for MKL-DNN
ciyongch commented on issue #14407: Update imagenet quantization script for MKL-DNN URL: https://github.com/apache/incubator-mxnet/pull/14407#issuecomment-474201445 Since PR #14466 enables signed int8 inputs to quantized FullyConnected, no need to apply this patch. Close it now. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] ciyongch commented on issue #14466: [MKL-DNN] Enable s8 support for inner product and 3d input with flatten=false
ciyongch commented on issue #14466: [MKL-DNN] Enable s8 support for inner product and 3d input with flatten=false URL: https://github.com/apache/incubator-mxnet/pull/14466#issuecomment-474200907 LGTM :) 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] ZhennanQin commented on a change in pull request #14466: [MKL-DNN] Enable s8 support for inner product and 3d input with flatten=false
ZhennanQin commented on a change in pull request #14466: [MKL-DNN] Enable s8 support for inner product and 3d input with flatten=false URL: https://github.com/apache/incubator-mxnet/pull/14466#discussion_r266728473 ## File path: src/operator/quantization/quantized_fully_connected.cc ## @@ -65,7 +68,13 @@ bool QuantizedFullyConnectedShape(const nnvm::NodeAttrs& attrs, SHAPE_ASSIGN_CHECK(*in_shape, i, mxnet::TShape{1}); } - SHAPE_ASSIGN_CHECK(*out_shape, 0, mxnet::TShape({dshape[0], wshape[0]})); + if (!param.flatten) { +TShape result_shape(dshape); +result_shape[dshape.ndim()-1] = param.num_hidden; Review comment: Add blank before and after operator. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] ZhennanQin commented on a change in pull request #14466: [MKL-DNN] Enable s8 support for inner product and 3d input with flatten=false
ZhennanQin commented on a change in pull request #14466: [MKL-DNN] Enable s8 support for inner product and 3d input with flatten=false URL: https://github.com/apache/incubator-mxnet/pull/14466#discussion_r266728459 ## File path: src/operator/quantization/quantized_fully_connected.cc ## @@ -50,11 +50,14 @@ bool QuantizedFullyConnectedShape(const nnvm::NodeAttrs& attrs, CHECK(!shape_is_none(in_shape->at(0))) << "QuantizedFullyConnectedOp input data shape must be given"; const mxnet::TShape& dshape = in_shape->at(0); - mxnet::TShape wshape = Shape2(param.num_hidden, dshape.ProdShape(1, dshape.ndim())); - if (dshape.ndim() != 2) { - CHECK(param.flatten) -<< "QuantizedFullyConnectedOp only supports flatten=true when ishape.ndim()!=2 for now. "; + index_t num_input; + if (!param.flatten) { +num_input = dshape[dshape.ndim()-1]; Review comment: Add blank before and after operator. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] arcadiaphy commented on issue #14451: fix custom operation in fork
arcadiaphy commented on issue #14451: fix custom operation in fork URL: https://github.com/apache/incubator-mxnet/pull/14451#issuecomment-47410 @YutingZhang I think the problem you mentioned is related to GIL, correctly handling GIL in c++ extension is a tricky problem, easy to cause deadlock. Now we have no such handling at all. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] arcadiaphy commented on issue #14451: fix custom operation in fork
arcadiaphy commented on issue #14451: fix custom operation in fork URL: https://github.com/apache/incubator-mxnet/pull/14451#issuecomment-474181960 @anirudh2290 The program blocks because of GIL, additional handling should be added to correctly run callbacks. ``` #include #include #include #include #include "./lib.h" callback *fun_python; void set_python_callback(callback *func) { fun_python = func; } class Foo { public: Foo() { pthread_atfork([]() { // call fun_python successfully std::cout << fun_python(5) << std::endl; // call fun_python failed in thread Py_BEGIN_ALLOW_THREADS std::thread t([]() { std::cout << fun_python(10) << std::endl;}); t.join(); Py_END_ALLOW_THREADS }, NULL, NULL); } }; static Foo f; ``` But adding this will make mxnet link against libpython, do we really want to do this? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] pengzhao-intel commented on issue #14466: [MKL-DNN] Enable s8 support for inner product and 3d input with flatten=false
pengzhao-intel commented on issue #14466: [MKL-DNN] Enable s8 support for inner product and 3d input with flatten=false URL: https://github.com/apache/incubator-mxnet/pull/14466#issuecomment-474179721 @reminisce @anirudh2290 @ZhennanQin @ciyongch please help take a review :) 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] ymjiang edited a comment on issue #13757: Set ImageNet data augmentation by default
ymjiang edited a comment on issue #13757: Set ImageNet data augmentation by default URL: https://github.com/apache/incubator-mxnet/pull/13757#issuecomment-474179103 @karan6181 @anirudhacharya Sorry for my delay. I committed two new changes to enable data-augmentation with command-line argument. Please review and see if they are appropriate. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] ymjiang commented on issue #13757: Set ImageNet data augmentation by default
ymjiang commented on issue #13757: Set ImageNet data augmentation by default URL: https://github.com/apache/incubator-mxnet/pull/13757#issuecomment-474179103 @karan6181 @anirudhacharya Sorry for my delay. I committed two new changes to enable data-augmentation with command-line argument. Please review if they are appropriate. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] xinyu-intel opened a new pull request #14466: [MKL-DNN] Enable s8 support for inner product and 3d input with flatten=false
xinyu-intel opened a new pull request #14466: [MKL-DNN] Enable s8 support for inner product and 3d input with flatten=false URL: https://github.com/apache/incubator-mxnet/pull/14466 ## Description ## **Major changes:** - Integrate mkl-dnn signed int8 inner product; - support 3-d input with flatten=false for both f32/int8 inner product. This PR can also fix issues in #14407 @pengzhao-intel @TaoLv @ciyongch ## 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 the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change ### Changes ### - [ ] Feature1, tests, (and when applicable, API doc) - [ ] 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 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] xinyu-intel closed pull request #13643: Remove mklml pre-install in ci
xinyu-intel closed pull request #13643: Remove mklml pre-install in ci URL: https://github.com/apache/incubator-mxnet/pull/13643 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: us...@infra.apache.org With regards, Apache Git Services
[incubator-mxnet-site] branch asf-site updated: Bump the publish timestamp.
This is an automated email from the ASF dual-hosted git repository. zhasheng pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/incubator-mxnet-site.git The following commit(s) were added to refs/heads/asf-site by this push: new bec1eb6 Bump the publish timestamp. bec1eb6 is described below commit bec1eb6084bca69ce04bf9c7ff6a0c6308d0d4e4 Author: mxnet-ci AuthorDate: Tue Mar 19 01:17:40 2019 + Bump the publish timestamp. --- date.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/date.txt b/date.txt new file mode 100644 index 000..d9d228a --- /dev/null +++ b/date.txt @@ -0,0 +1 @@ +Tue Mar 19 01:17:40 UTC 2019
[GitHub] [incubator-mxnet] ZhennanQin commented on a change in pull request #14277: Enhance PartitionGraph
ZhennanQin commented on a change in pull request #14277: Enhance PartitionGraph URL: https://github.com/apache/incubator-mxnet/pull/14277#discussion_r266699111 ## File path: src/operator/subgraph/subgraph_property.h ## @@ -200,7 +197,7 @@ typedef dmlc::ThreadLocalStore__REGISTER_OR_GET__(#Name, &SubgraphPropertyType::Create) +SubgraphPropertyRegistry::Get()->__REGISTER__(#Name, &SubgraphPropertyType::Create) Review comment: @anirudh2290 I've consider the way you suggested, including other formats like, ``` MXNET_REGISTER_BACKEND(default, {DefaultSubgraphProperty, DefaultSubgraphProperty}) ``` or ``` MXNET_REGISTER_BACKEND(default, DefaultSubgraphProperty, 0) MXNET_REGISTER_BACKEND(default, DefaultSubgraphProperty, 1) ``` But I give them up because of different reasons. The first problem is, `DefaultSubgraphProperty` is only the name of class, but not a object or function. So it can't be inserted in a vector. The correct line is, ``` MXNET_REGISTER_BACKEND(default, {DefaultSubgraphProperty::Create(), DefaultSubgraphProperty::Create()}) ``` But it's not elegant. For your suggestion, ``` MXNET_REGISTER_BACKEND(default, DefaultSubgraphProperty, DefaultSubgraphProperty) ``` It should work if we define `MXNET_REGISTER_BACKEND` with 3 arguments. But it's not scalable because if we want to register more property for this backend, we need to write more `MXNET_REGISTER_BACKEND` implementation with more number of arguments. For ``` MXNET_REGISTER_BACKEND(default, DefaultSubgraphProperty, 0) MXNET_REGISTER_BACKEND(default, DefaultSubgraphProperty, 1) ``` This can help to avoid register property twice unexceptly from header as it defines the execution order. But this will make code a bit ugly. Personally, I prefer the current implementation although we need to use it carefully, like not putting `MXNET_REGISTER_SUBGRAPH_PROPERTY` in header. But I don't mind to change to other idea I listed above. Then you can make the final decision now, and I will follow it. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] marcoabreu closed issue #14458: Create a Dataset Using RecordIO
marcoabreu closed issue #14458: Create a Dataset Using RecordIO URL: https://github.com/apache/incubator-mxnet/issues/14458 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #12641: Add docker file which includes sample jupyter notebook (#12611)
karan6181 commented on issue #12641: Add docker file which includes sample jupyter notebook (#12611) URL: https://github.com/apache/incubator-mxnet/pull/12641#issuecomment-474155735 @gautamkmr Thank you for your contribution! Can you please provide the update on this PR since there is no activity from last couple of weeks. Thank you! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #12502: [NGRAPH] MXNet - nGraph initial integration
karan6181 commented on issue #12502: [NGRAPH] MXNet - nGraph initial integration URL: https://github.com/apache/incubator-mxnet/pull/12502#issuecomment-474154995 @mbrookhart @ashokei Thank you for your contribution! can you please address the review comments? Thank you! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #12781: Fixed issue #12745
karan6181 commented on issue #12781: Fixed issue #12745 URL: https://github.com/apache/incubator-mxnet/pull/12781#issuecomment-474154532 @LuckyPigeon Can you please address the review comments? @aaronmarkham Could you please review this PR again? Thank you! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #13132: enabled link checker and doc test during building the doc
karan6181 commented on issue #13132: enabled link checker and doc test during building the doc URL: https://github.com/apache/incubator-mxnet/pull/13132#issuecomment-474154287 @mli Thank you for your contribution! Can you please look into this PR and close it or let us know if the changes are not relevant with the new website setup!! Thank you 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #13643: Remove mklml pre-install in ci
karan6181 commented on issue #13643: Remove mklml pre-install in ci URL: https://github.com/apache/incubator-mxnet/pull/13643#issuecomment-474153891 @xinyu-intel Thank you for your contribution! Could you please address the review comments? Thanks 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #13322: Change CUB submodule to track Nvidia CUB project.
karan6181 commented on issue #13322: Change CUB submodule to track Nvidia CUB project. URL: https://github.com/apache/incubator-mxnet/pull/13322#issuecomment-474153543 @frankfliu Could you please look at the incomplete CI? It seems no updates from last couple of weeks. Can you please look into it? Thanks! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #13400: [MXNET-1229] use OpenBLAS, lapack & OpenCV from conan
karan6181 commented on issue #13400: [MXNET-1229] use OpenBLAS, lapack & OpenCV from conan URL: https://github.com/apache/incubator-mxnet/pull/13400#issuecomment-474153201 @szha Could you please review this PR again? Thank you! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #13401: [MXNET-1227] Adding CornerPooling operator
karan6181 commented on issue #13401: [MXNET-1227] Adding CornerPooling operator URL: https://github.com/apache/incubator-mxnet/pull/13401#issuecomment-474152750 @BigDeviltjj Can you please address the @anirudh2290 comments? Also, please resolve the branch conflicts. Thanks! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #13574: Replaced rand_r with std:: random generation
karan6181 commented on issue #13574: Replaced rand_r with std:: random generation URL: https://github.com/apache/incubator-mxnet/pull/13574#issuecomment-474152407 @lebeg Did you get a chance to look at the RandGenerator implementation ? Can you please make the relevant code changes for that? Thank you! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #13576: [MXNET-679] Improved CMakeLists.txt
karan6181 commented on issue #13576: [MXNET-679] Improved CMakeLists.txt URL: https://github.com/apache/incubator-mxnet/pull/13576#issuecomment-474152050 @lebeg Could you please re-trigger the CI again since some tests are failing and can you please address the comments? Thank you! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #13715: Add C++ Predictor class for inference
karan6181 commented on issue #13715: Add C++ Predictor class for inference URL: https://github.com/apache/incubator-mxnet/pull/13715#issuecomment-474151702 @stu1130 @ChaiBapchya @KellenSunderland Could you please review this PR again? Thank you! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #13757: Set ImageNet data augmentation by default
karan6181 commented on issue #13757: Set ImageNet data augmentation by default URL: https://github.com/apache/incubator-mxnet/pull/13757#issuecomment-474151356 @ymjiang Could you please address the review comments made by @anirudhacharya. It seems no updates since last 2 weeks. Thanks! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #13763: [contrib][op] fix MultiBoxPrior confusing results if first ratio is not 1.0
karan6181 commented on issue #13763: [contrib][op] fix MultiBoxPrior confusing results if first ratio is not 1.0 URL: https://github.com/apache/incubator-mxnet/pull/13763#issuecomment-474150843 @zhreshold Could you please provide an update on this PR? It seems no tracking for last 2 weeks. Thanks ! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] astonzhang opened a new pull request #14465: [MXNET-1361] Change 'The Straight Dope' to 'Dive into Deep Learning' on the website
astonzhang opened a new pull request #14465: [MXNET-1361] Change 'The Straight Dope' to 'Dive into Deep Learning' on the website URL: https://github.com/apache/incubator-mxnet/pull/14465 ## Description ## Change *The Straight Dope* to *Dive into Deep Learning* on the website. JIRA: https://issues.apache.org/jira/browse/MXNET-1361 ## 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 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 ### Changes ### - [x] Doc update. ## Comments ## NA 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #13906: [MXNET-703] Update onnx-tensorrt for int8/fp16 support
karan6181 commented on issue #13906: [MXNET-703] Update onnx-tensorrt for int8/fp16 support URL: https://github.com/apache/incubator-mxnet/pull/13906#issuecomment-474150308 @KellenSunderland can you please address the review comments? @Roshrini @vandanavk Can you please review it? Thanks! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #13955: adding the gluon implementation of deformable convolution
karan6181 commented on issue #13955: adding the gluon implementation of deformable convolution URL: https://github.com/apache/incubator-mxnet/pull/13955#issuecomment-474149937 @suyz526 Can you please check the CI failure? No updates since couple of weeks. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #14028: Cmake blas
karan6181 commented on issue #14028: Cmake blas URL: https://github.com/apache/incubator-mxnet/pull/14028#issuecomment-474149586 @edisongustavo Thank you for your contributions! Can you please provide some updates in this PR? Thanks! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk edited a comment on issue #14434: could i set multi kv_store in distribute training program?
zachgk edited a comment on issue #14434: could i set multi kv_store in distribute training program? URL: https://github.com/apache/incubator-mxnet/issues/14434#issuecomment-474149386 @mxnet-label-bot add [Feature request] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk commented on issue #14434: could i set multi kv_store in distribute training program?
zachgk commented on issue #14434: could i set multi kv_store in distribute training program? URL: https://github.com/apache/incubator-mxnet/issues/14434#issuecomment-474149386 @mxnet-label-bot add [Feature] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #14040: Reformat of TensorRT to use subgraph API
karan6181 commented on issue #14040: Reformat of TensorRT to use subgraph API URL: https://github.com/apache/incubator-mxnet/pull/14040#issuecomment-474149318 @KellenSunderland and @anirudh2290 could you please review this PR again. Thanks ! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk commented on issue #14438: Fixing unintentional variable overloading
zachgk commented on issue #14438: Fixing unintentional variable overloading URL: https://github.com/apache/incubator-mxnet/pull/14438#issuecomment-474148975 @zjost Cool trick: If you edit the PR description and add `resolves #14439`, then it will automatically resolve the issue when the PR is merged (https://help.github.com/en/articles/closing-issues-using-keywords). Otherwise, it is good to at least mention the issue from the PR. Your PR is breaking on the clojure test due to an unrelated issue (#14448). You should rebase your commit onto master (git pull --rebase) so the fix to that issue is applied to your commit. It should pass the CI after that 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] abhinavs95 commented on a change in pull request #14442: [MXNet-1349][WIP][Fit API]Add validation support and unit tests for fit() API
abhinavs95 commented on a change in pull request #14442: [MXNet-1349][WIP][Fit API]Add validation support and unit tests for fit() API URL: https://github.com/apache/incubator-mxnet/pull/14442#discussion_r266688958 ## File path: python/mxnet/gluon/estimator/estimator.py ## @@ -253,8 +294,14 @@ def fit(self, train_data, for handler in event_handlers: handler.batch_end() -for metric in self.metrics + self.loss_metrics: +if do_validation: +self._evaluate(val_data, batch_fn) + +for metric in self.train_metrics + self.train_loss_metrics: self.train_stats['train_' + metric.name].append(metric.get()[1]) +for metric in self.test_metrics + self.test_loss_metrics: Review comment: we can use `test_metrics` for both validation (at epoch end) and test (at train end) dataset 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] haojin2 commented on a change in pull request #14449: GELU Operator
haojin2 commented on a change in pull request #14449: GELU Operator URL: https://github.com/apache/incubator-mxnet/pull/14449#discussion_r266688546 ## File path: src/operator/mshadow_op.h ## @@ -127,6 +131,20 @@ MXNET_UNARY_MATH_OP(softsign, a / (1.0f + math::fabs(a))); MXNET_UNARY_MATH_OP(softsign_grad, 1.0f / math::sqr(1.0f + math::fabs(a))); +#define gelu_gx(a) \ Review comment: Done. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk commented on issue #14383: MXNET_BACKWARD_DO_MIRROR is broken
zachgk commented on issue #14383: MXNET_BACKWARD_DO_MIRROR is broken URL: https://github.com/apache/incubator-mxnet/issues/14383#issuecomment-474148127 @mxnet-label-bot add [Gluon, Bug] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #14053: in-place reshape ops
karan6181 commented on issue #14053: in-place reshape ops URL: https://github.com/apache/incubator-mxnet/pull/14053#issuecomment-474148069 @szha Thank you for your contributions! Is this PR work in progress? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] andrewfayres commented on issue #14458: Create a Dataset Using RecordIO
andrewfayres commented on issue #14458: Create a Dataset Using RecordIO URL: https://github.com/apache/incubator-mxnet/issues/14458#issuecomment-474147629 @mxnet-label-bot add [Question, Example] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #14071: [MXNET-1269] Scoverage
karan6181 commented on issue #14071: [MXNET-1269] Scoverage URL: https://github.com/apache/incubator-mxnet/pull/14071#issuecomment-474147486 @yzhliu and @nswamy Can you please review this PR. @zachgk Can you please look into the CI failure? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] piyushghai commented on a change in pull request #14442: [MXNet-1349][WIP][Fit API]Add validation support and unit tests for fit() API
piyushghai commented on a change in pull request #14442: [MXNet-1349][WIP][Fit API]Add validation support and unit tests for fit() API URL: https://github.com/apache/incubator-mxnet/pull/14442#discussion_r266687712 ## File path: tests/python/unittest/test_gluon_estimator.py ## @@ -0,0 +1,238 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +''' Unit tests for Gluon Estimator ''' + +import warnings +from nose.tools import assert_raises +import mxnet as mx +from mxnet import gluon +from mxnet.gluon import nn +from mxnet.gluon.estimator import estimator + +def get_model(): +net = nn.Sequential() +net.add(nn.Dense(4, activation='relu', flatten=False)) +return net + +def test_fit(): +''' test estimator with different train data types ''' +net = get_model() +num_epochs = 1 +batch_size = 4 +ctx = mx.cpu() +loss = gluon.loss.L2Loss() +acc = mx.metric.Accuracy() +net.initialize(ctx=ctx) +trainer = gluon.Trainer(net.collect_params(), 'sgd', {'learning_rate': 0.001}) +est = estimator.Estimator(net=net, + loss=loss, + metrics=acc, + trainers=trainer, + context=ctx) +in_data = mx.nd.random.uniform(shape=(10, 3)) +out_data = mx.nd.random.uniform(shape=(10, 4)) +# Input dataloader +dataset = gluon.data.dataset.ArrayDataset(in_data, out_data) +train_dataloader = gluon.data.DataLoader(dataset, batch_size=batch_size) +est.fit(train_data=train_dataloader, +epochs=num_epochs, +batch_size=batch_size) + +# Input dataiter +train_dataiter = mx.io.NDArrayIter(data=in_data, label=out_data, batch_size=batch_size) +est.fit(train_data=train_dataiter, +epochs=num_epochs, +batch_size=batch_size) + +# Input NDArray +with assert_raises(ValueError): +est.fit(train_data=[in_data, out_data], +epochs=num_epochs, +batch_size=batch_size) + + +def test_validation(): +''' test different validation data types''' +net = get_model() +num_epochs = 1 +batch_size = 4 +ctx = mx.cpu() +loss = gluon.loss.L2Loss() +acc = mx.metric.Accuracy() +net.initialize(ctx=ctx) +trainer = gluon.Trainer(net.collect_params(), 'sgd', {'learning_rate': 0.001}) +est = estimator.Estimator(net=net, + loss=loss, + metrics=acc, + trainers=trainer, + context=ctx) +in_data = mx.nd.random.uniform(shape=(10, 3)) +out_data = mx.nd.random.uniform(shape=(10, 4)) +# Input dataloader +dataset = gluon.data.dataset.ArrayDataset(in_data, out_data) +train_dataloader = gluon.data.DataLoader(dataset, batch_size=batch_size) +val_dataloader = gluon.data.DataLoader(dataset, batch_size=batch_size) +est.fit(train_data=train_dataloader, +val_data=val_dataloader, +epochs=num_epochs, +batch_size=batch_size) + +# Input dataiter +train_dataiter = mx.io.NDArrayIter(data=in_data, label=out_data, batch_size=batch_size) +val_dataiter = mx.io.NDArrayIter(data=in_data, label=out_data, batch_size=batch_size) +est.fit(train_data=train_dataiter, +val_data=val_dataiter, +epochs=num_epochs, +batch_size=batch_size) +# Input NDArray +with assert_raises(ValueError): +est.fit(train_data=[in_data, out_data], +val_data=[in_data, out_data], +epochs=num_epochs, +batch_size=batch_size) + +def test_initializer(): +''' test with no initializer, inconsistent initializer ''' +net = get_model() +num_epochs = 1 +batch_size = 4 +ctx = mx.cpu() +in_data = mx.nd.random.uniform(shape=(10, 3)) +out_data = mx.nd.random.uniform(shape=(10, 4)) +dataset = gluon.data.dataset.ArrayDataset(in_data, out_data) +train_data = gluon.data.DataLoader(dataset, batch_size=batch_size) +loss = gluon.loss.L2Loss() +acc = mx.metric.Accuracy() +# no initializer +est = estimator.Estimator(net=net, +
[GitHub] [incubator-mxnet] piyushghai commented on a change in pull request #14442: [MXNet-1349][WIP][Fit API]Add validation support and unit tests for fit() API
piyushghai commented on a change in pull request #14442: [MXNet-1349][WIP][Fit API]Add validation support and unit tests for fit() API URL: https://github.com/apache/incubator-mxnet/pull/14442#discussion_r266687402 ## File path: python/mxnet/gluon/estimator/estimator.py ## @@ -253,8 +294,14 @@ def fit(self, train_data, for handler in event_handlers: handler.batch_end() -for metric in self.metrics + self.loss_metrics: +if do_validation: +self._evaluate(val_data, batch_fn) + +for metric in self.train_metrics + self.train_loss_metrics: self.train_stats['train_' + metric.name].append(metric.get()[1]) +for metric in self.test_metrics + self.test_loss_metrics: Review comment: Can we rename ```test_metrics``` to ```val_metrics``` for consistency, since we are referring to them as validation stuff throughout 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] tlby commented on issue #14461: [MXNET-1359] Adds a multiclass-MCC metric derived from Pearson
tlby commented on issue #14461: [MXNET-1359] Adds a multiclass-MCC metric derived from Pearson URL: https://github.com/apache/incubator-mxnet/pull/14461#issuecomment-474147085 hmm, actually `numpy.corrcoef()` may not be working how I need for the multiclass class. This work is based on the [formulas here](http://rk.kvl.dk/introduction/index.html) which relate Matthews to Pearson, but I may need to calculate the covariance myself. And of course this PR should have some tests added. I'll work through both these issues. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk commented on issue #14447: Seg Fault while using Randomized relu activation function
zachgk commented on issue #14447: Seg Fault while using Randomized relu activation function URL: https://github.com/apache/incubator-mxnet/issues/14447#issuecomment-474147028 @mxnet-label-bot add [Backend, Operator, Bug] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] piyushghai commented on a change in pull request #14464: Fixed issue where the estimator was printing beyond the dataset size …
piyushghai commented on a change in pull request #14464: Fixed issue where the estimator was printing beyond the dataset size … URL: https://github.com/apache/incubator-mxnet/pull/14464#discussion_r266687216 ## File path: python/mxnet/gluon/estimator/estimator.py ## @@ -242,7 +242,9 @@ def fit(self, train_data, self.train_stats['batch_' + loss_metric.name] = loss_metric.get()[1] try: -self.train_stats['step'] = "{}/{}".format(batch_size * (i + 1), len(train_data._dataset)) +completed_samples = len(train_data._dataset) if i == len(train_data._dataset) - 1 \ Review comment: Done. 568d5dfaa260a8e3c07bc36c53ae334fc7c64743 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #14078: [MXNET-14075] repair example, enable fault tolerant build of R reference manual
karan6181 commented on issue #14078: [MXNET-14075] repair example, enable fault tolerant build of R reference manual URL: https://github.com/apache/incubator-mxnet/pull/14078#issuecomment-474146857 @shadogray is the build still failing? I see no activities since Feb-15 on this PR. Can you please look into it and let us know if this PR needs to close it? Thanks! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] roywei commented on a change in pull request #14464: Fixed issue where the estimator was printing beyond the dataset size …
roywei commented on a change in pull request #14464: Fixed issue where the estimator was printing beyond the dataset size … URL: https://github.com/apache/incubator-mxnet/pull/14464#discussion_r266686740 ## File path: python/mxnet/gluon/estimator/estimator.py ## @@ -242,7 +242,9 @@ def fit(self, train_data, self.train_stats['batch_' + loss_metric.name] = loss_metric.get()[1] try: -self.train_stats['step'] = "{}/{}".format(batch_size * (i + 1), len(train_data._dataset)) +completed_samples = len(train_data._dataset) if i == len(train_data._dataset) - 1 \ Review comment: a comment for readability? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] andrewfayres commented on issue #14450: broken clojure test
andrewfayres commented on issue #14450: broken clojure test URL: https://github.com/apache/incubator-mxnet/issues/14450#issuecomment-474146585 Issue was resolved with #14448 which disabled the tests. Those tests have a dependency on an external repository which was experiencing an outage. There is an open issue about how to handle this dependency here #14394. @mxnet-label-bot add [Test, Clojure] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk commented on issue #14456: python import error
zachgk commented on issue #14456: python import error URL: https://github.com/apache/incubator-mxnet/issues/14456#issuecomment-474146260 @mxnet-label-bot add [Build] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #14113: Enhance subgraph API
karan6181 commented on issue #14113: Enhance subgraph API URL: https://github.com/apache/incubator-mxnet/pull/14113#issuecomment-474146156 @ZhennanQin Could you please re-trigger the CI and see why some of the checks are still waiting? Thanks ! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] piyushghai opened a new pull request #14464: Fixed issue where the estimator was printing beyond the dataset size …
piyushghai opened a new pull request #14464: Fixed issue where the estimator was printing beyond the dataset size … URL: https://github.com/apache/incubator-mxnet/pull/14464 …for the last batch ## Description ## As title. @roywei @abhinavs95 @karan6181 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] piyushghai commented on issue #14464: Fixed issue where the estimator was printing beyond the dataset size …
piyushghai commented on issue #14464: Fixed issue where the estimator was printing beyond the dataset size … URL: https://github.com/apache/incubator-mxnet/pull/14464#issuecomment-474146088 @mxnet-label-bot Add [Gluon] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #14140: Doc Fix: added note about cuda9.2 requirement to Java example
karan6181 commented on issue #14140: Doc Fix: added note about cuda9.2 requirement to Java example URL: https://github.com/apache/incubator-mxnet/pull/14140#issuecomment-474145921 @samskalicky Can you please address the review comments ? Thanks! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk commented on issue #14457: [Flaky Test] Python 3: GPU WIN test_operator_gpu.test_multinomial_generator
zachgk commented on issue #14457: [Flaky Test] Python 3: GPU WIN test_operator_gpu.test_multinomial_generator URL: https://github.com/apache/incubator-mxnet/issues/14457#issuecomment-474145714 @mxnet-label-bot add [Test, Flaky, Windows, Python] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #14196: Group Normalization
karan6181 commented on issue #14196: Group Normalization URL: https://github.com/apache/incubator-mxnet/pull/14196#issuecomment-474145564 @zhanghang1989 Can you please address the review comments and try to merge this PR? Thanks! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk commented on issue #14458: Create a Dataset Using RecordIO
zachgk commented on issue #14458: Create a Dataset Using RecordIO URL: https://github.com/apache/incubator-mxnet/issues/14458#issuecomment-474145403 For questions, please submit them on MXNet discussion forum (https://discuss.mxnet.io), where it will get a wider audience and allow other to learn as well. I'm closing this issue now in favor of the discussion forum issue you will file, please feel free to re-open if closed in error. Thanks! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] karan6181 commented on issue #14319: CI Changes for Codified Windows AMIs
karan6181 commented on issue #14319: CI Changes for Codified Windows AMIs URL: https://github.com/apache/incubator-mxnet/pull/14319#issuecomment-474145226 @Roshrini Can you please close this PR since it is already been merged in this PR [#14336](https://github.com/apache/incubator-mxnet/pull/14336) 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] piyushghai commented on a change in pull request #14462: [MXNET-1358][Fit API] Fit api tutorial
piyushghai commented on a change in pull request #14462: [MXNET-1358][Fit API] Fit api tutorial URL: https://github.com/apache/incubator-mxnet/pull/14462#discussion_r266684296 ## File path: docs/tutorials/gluon/fit_api_tutorial.md ## @@ -0,0 +1,311 @@ + + + + + + + + + + + + + + + + + +# Gluon Fit API + +In this tutorial, we will see how to use the [Gluon Fit API](https://cwiki.apache.org/confluence/display/MXNET/Gluon+Fit+API+-+Tech+Design) which is a simple and flexible way to train deep learning models using the [Gluon APIs](http://mxnet.incubator.apache.org/versions/master/gluon/index.html) in Apache MXNet. + +Prior to Fit API, training using Gluon required one to write a custom ["Gluon training loop"](https://mxnet.incubator.apache.org/versions/master/tutorials/gluon/logistic_regression_explained.html#defining-and-training-the-model). Fit API reduces the complexity and amount of boiler plate code required to train a model, provides an easy to use and a powerful API. + +To demonstrate the Fit API, this tutorial will train an Image Classification model using the [AlexNet](https://arxiv.org/abs/1404.5997) architecture for the neural network. The model will be trained using the [Fashion-MNIST dataset](https://research.zalando.com/welcome/mission/research-projects/fashion-mnist/). + + +## Prerequisites + +To complete this tutorial, you will need: + +- [MXNet](https://mxnet.incubator.apache.org/install/#overview) (The version of MXNet will be >= 1.5.0) +- [GluonCV](https://gluon-cv.mxnet.io) + +This tutorial works with both Python 2 and Python 3. + + + +```python +import mxnet as mx +from mxnet import gluon, autograd +from gluoncv import utils +from gluoncv.model_zoo import get_model +from mxnet.gluon.estimator import estimator + +ctx = mx.gpu(0) # Or mx.cpu(0) is using a GPU backed machine +mx.random.seed(7) # Set a fixed seed +``` + +## Dataset + +[Fashion-MNIST](https://research.zalando.com/welcome/mission/research-projects/fashion-mnist/) dataset consists of fashion items divided into ten categories : t-shirt/top, trouser, pullover, dress, coat, sandal, shirt, sneaker, bag and ankle boot. + +- It has 60,000 gray scale images of size 28 * 28 for training. +- It has 10,000 gray scale images os size 28 * 28 for testing/validation. + +We will use ```gluon.data.vision``` package to directly import the Fashion-MNIST dataset and perform pre-processing on it. + + +```python +# Get the training data +fashion_mnist_train = gluon.data.vision.FashionMNIST(train=True) + +# Get the validation data +fashion_mnist_val = gluon.data.vision.FashionMNIST(train=False) +``` + +## Exploring the Data + + +```python +text_labels = ['t-shirt/top', 'trouser', 'pullover', 'dress', 'coat', + 'sandal', 'shirt', 'sneaker', 'bag', 'ankle boot'] + +# Let's print the size of the dataset for train and validation. +print ("Number of training samples : %d" % (len(fashion_mnist_train))) +print ("Number of validation samples : %d" % (len(fashion_mnist_val))) + + +train_first_elem, train_first_label = fashion_mnist_train[0] +print ("Shape of each iamge : ", train_first_elem.shape) +``` + +Number of training samples : 6 +Number of validation samples : 1 +Shape of each iamge : (28, 28, 1) + + +Now let's try to visualize the dataset before we proceed further + + +```python +from IPython import display +import matplotlib.pyplot as plt + +# Function to display the data +def show_fashion_mnist_data(images, labels): +display.set_matplotlib_formats('svg') +_, figs = plt.subplots(1, len(images), figsize=(12, 12)) + +for figure, x, y in zip(figs, images, labels): +figure.imshow(x.reshape((28, 28)).asnumpy()) +axes = figure.axes +axes.set_title(text_labels[int(y)]) +axes.title.set_fontsize(12) +axes.get_xaxis().set_visible(False) +axes.get_yaxis().set_visible(False) + +plt.show() +``` + + +```python +images, labels = fashion_mnist_train[0:10] +show_fashion_mnist_data(images, labels) +``` + + +![png](https://raw.githubusercontent.com/piyushghai/web-data/master/mxnet/doc/tutorials/gluon/fashion_mnist.png) + + +## Pre-processing the data + +In order to prepare our data to training the model, we will perform a few pre-processing steps on the dataset. We will : +- Resize the image +- Convert the pixel values in the image from (0 to 255) to (0 to 1) +- Normalize the images with mean 0 and variance 1. + +We will be using ```gluon.data.vision.tranforms``` which provides out of the box transformation APIs. +To read more about the available transformations, check out [the official documentation](https://mxnet.incubator.apache.org/api/python/gluon/data.html#vision-transforms). + + +```python +transformers = [gluon.data.vision.transforms.Resize(224), # We pick 224 as the model we use takes an input of size 224. +gluon.data.vision.transforms.ToTensor(), +gluon.data.v
[GitHub] [incubator-mxnet] piyushghai commented on a change in pull request #14462: [MXNET-1358][Fit API] Fit api tutorial
piyushghai commented on a change in pull request #14462: [MXNET-1358][Fit API] Fit api tutorial URL: https://github.com/apache/incubator-mxnet/pull/14462#discussion_r266684214 ## File path: docs/tutorials/gluon/fit_api_tutorial.md ## @@ -0,0 +1,311 @@ + + + + + + + + + + + + + + + + + +# Gluon Fit API + +In this tutorial, we will see how to use the [Gluon Fit API](https://cwiki.apache.org/confluence/display/MXNET/Gluon+Fit+API+-+Tech+Design) which is a simple and flexible way to train deep learning models using the [Gluon APIs](http://mxnet.incubator.apache.org/versions/master/gluon/index.html) in Apache MXNet. + +Prior to Fit API, training using Gluon required one to write a custom ["Gluon training loop"](https://mxnet.incubator.apache.org/versions/master/tutorials/gluon/logistic_regression_explained.html#defining-and-training-the-model). Fit API reduces the complexity and amount of boiler plate code required to train a model, provides an easy to use and a powerful API. + +To demonstrate the Fit API, this tutorial will train an Image Classification model using the [AlexNet](https://arxiv.org/abs/1404.5997) architecture for the neural network. The model will be trained using the [Fashion-MNIST dataset](https://research.zalando.com/welcome/mission/research-projects/fashion-mnist/). + + +## Prerequisites + +To complete this tutorial, you will need: + +- [MXNet](https://mxnet.incubator.apache.org/install/#overview) (The version of MXNet will be >= 1.5.0) +- [GluonCV](https://gluon-cv.mxnet.io) Review comment: Okay. Let me try that. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] lupesko commented on issue #10792: [MXNET-400] support string type for kvstore key in cpp-package
lupesko commented on issue #10792: [MXNET-400] support string type for kvstore key in cpp-package URL: https://github.com/apache/incubator-mxnet/pull/10792#issuecomment-474144072 @nihui - since there was no feedback/follow up on feedback since May 2018, we should probably close the PR. You can always re-open if done in error. @Roshrini can you please help by closing this? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk commented on issue #14459: Cannot release memory sometimes
zachgk commented on issue #14459: Cannot release memory sometimes URL: https://github.com/apache/incubator-mxnet/issues/14459#issuecomment-474142486 @ShownX Can you provide some more information? Can you give the example or a minimal script that causes the problem? Can you also provide the above information about the package you are using (Python, R, Scala, etc.) and run the diagnosis script: ``` What to do: 1. Download the diagnosis script from https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py 2. Run the script using `python diagnose.py` and paste its output here. ``` @mxnet-label-bot add [Memory, Exception Handling, Pending Requester Info] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk removed a comment on issue #14459: Cannot release memory sometimes
zachgk removed a comment on issue #14459: Cannot release memory sometimes URL: https://github.com/apache/incubator-mxnet/issues/14459#issuecomment-474142540 @mxnet-label-bot add [Memory, Exception Handling, Pending Requester Info] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk commented on issue #14459: Cannot release memory sometimes
zachgk commented on issue #14459: Cannot release memory sometimes URL: https://github.com/apache/incubator-mxnet/issues/14459#issuecomment-474142540 @mxnet-label-bot add [Memory, Exception Handling, Pending Requester Info] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] abhinavs95 commented on a change in pull request #14462: [MXNET-1358][Fit API] Fit api tutorial
abhinavs95 commented on a change in pull request #14462: [MXNET-1358][Fit API] Fit api tutorial URL: https://github.com/apache/incubator-mxnet/pull/14462#discussion_r266680655 ## File path: docs/tutorials/gluon/fit_api_tutorial.md ## @@ -0,0 +1,311 @@ + + + + + + + + + + + + + + + + + +# Gluon Fit API + +In this tutorial, we will see how to use the [Gluon Fit API](https://cwiki.apache.org/confluence/display/MXNET/Gluon+Fit+API+-+Tech+Design) which is a simple and flexible way to train deep learning models using the [Gluon APIs](http://mxnet.incubator.apache.org/versions/master/gluon/index.html) in Apache MXNet. + +Prior to Fit API, training using Gluon required one to write a custom ["Gluon training loop"](https://mxnet.incubator.apache.org/versions/master/tutorials/gluon/logistic_regression_explained.html#defining-and-training-the-model). Fit API reduces the complexity and amount of boiler plate code required to train a model, provides an easy to use and a powerful API. + +To demonstrate the Fit API, this tutorial will train an Image Classification model using the [AlexNet](https://arxiv.org/abs/1404.5997) architecture for the neural network. The model will be trained using the [Fashion-MNIST dataset](https://research.zalando.com/welcome/mission/research-projects/fashion-mnist/). + + +## Prerequisites + +To complete this tutorial, you will need: + +- [MXNet](https://mxnet.incubator.apache.org/install/#overview) (The version of MXNet will be >= 1.5.0) +- [GluonCV](https://gluon-cv.mxnet.io) Review comment: can avoid GluonCV dependency by using Gluon model zoo instead 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] abhinavs95 commented on a change in pull request #14462: [MXNET-1358][Fit API] Fit api tutorial
abhinavs95 commented on a change in pull request #14462: [MXNET-1358][Fit API] Fit api tutorial URL: https://github.com/apache/incubator-mxnet/pull/14462#discussion_r266682419 ## File path: docs/tutorials/gluon/fit_api_tutorial.md ## @@ -0,0 +1,311 @@ + + + + + + + + + + + + + + + + + +# Gluon Fit API + +In this tutorial, we will see how to use the [Gluon Fit API](https://cwiki.apache.org/confluence/display/MXNET/Gluon+Fit+API+-+Tech+Design) which is a simple and flexible way to train deep learning models using the [Gluon APIs](http://mxnet.incubator.apache.org/versions/master/gluon/index.html) in Apache MXNet. + +Prior to Fit API, training using Gluon required one to write a custom ["Gluon training loop"](https://mxnet.incubator.apache.org/versions/master/tutorials/gluon/logistic_regression_explained.html#defining-and-training-the-model). Fit API reduces the complexity and amount of boiler plate code required to train a model, provides an easy to use and a powerful API. + +To demonstrate the Fit API, this tutorial will train an Image Classification model using the [AlexNet](https://arxiv.org/abs/1404.5997) architecture for the neural network. The model will be trained using the [Fashion-MNIST dataset](https://research.zalando.com/welcome/mission/research-projects/fashion-mnist/). + + +## Prerequisites + +To complete this tutorial, you will need: + +- [MXNet](https://mxnet.incubator.apache.org/install/#overview) (The version of MXNet will be >= 1.5.0) +- [GluonCV](https://gluon-cv.mxnet.io) + +This tutorial works with both Python 2 and Python 3. + + + +```python +import mxnet as mx +from mxnet import gluon, autograd +from gluoncv import utils +from gluoncv.model_zoo import get_model +from mxnet.gluon.estimator import estimator + +ctx = mx.gpu(0) # Or mx.cpu(0) is using a GPU backed machine +mx.random.seed(7) # Set a fixed seed +``` + +## Dataset + +[Fashion-MNIST](https://research.zalando.com/welcome/mission/research-projects/fashion-mnist/) dataset consists of fashion items divided into ten categories : t-shirt/top, trouser, pullover, dress, coat, sandal, shirt, sneaker, bag and ankle boot. + +- It has 60,000 gray scale images of size 28 * 28 for training. +- It has 10,000 gray scale images os size 28 * 28 for testing/validation. + +We will use ```gluon.data.vision``` package to directly import the Fashion-MNIST dataset and perform pre-processing on it. + + +```python +# Get the training data +fashion_mnist_train = gluon.data.vision.FashionMNIST(train=True) + +# Get the validation data +fashion_mnist_val = gluon.data.vision.FashionMNIST(train=False) +``` + +## Exploring the Data + + +```python +text_labels = ['t-shirt/top', 'trouser', 'pullover', 'dress', 'coat', + 'sandal', 'shirt', 'sneaker', 'bag', 'ankle boot'] + +# Let's print the size of the dataset for train and validation. +print ("Number of training samples : %d" % (len(fashion_mnist_train))) +print ("Number of validation samples : %d" % (len(fashion_mnist_val))) + + +train_first_elem, train_first_label = fashion_mnist_train[0] +print ("Shape of each iamge : ", train_first_elem.shape) +``` + +Number of training samples : 6 +Number of validation samples : 1 +Shape of each iamge : (28, 28, 1) + + +Now let's try to visualize the dataset before we proceed further + + +```python +from IPython import display +import matplotlib.pyplot as plt + +# Function to display the data +def show_fashion_mnist_data(images, labels): +display.set_matplotlib_formats('svg') +_, figs = plt.subplots(1, len(images), figsize=(12, 12)) + +for figure, x, y in zip(figs, images, labels): +figure.imshow(x.reshape((28, 28)).asnumpy()) +axes = figure.axes +axes.set_title(text_labels[int(y)]) +axes.title.set_fontsize(12) +axes.get_xaxis().set_visible(False) +axes.get_yaxis().set_visible(False) + +plt.show() +``` + + +```python +images, labels = fashion_mnist_train[0:10] +show_fashion_mnist_data(images, labels) +``` + + +![png](https://raw.githubusercontent.com/piyushghai/web-data/master/mxnet/doc/tutorials/gluon/fashion_mnist.png) + + +## Pre-processing the data + +In order to prepare our data to training the model, we will perform a few pre-processing steps on the dataset. We will : +- Resize the image +- Convert the pixel values in the image from (0 to 255) to (0 to 1) +- Normalize the images with mean 0 and variance 1. + +We will be using ```gluon.data.vision.tranforms``` which provides out of the box transformation APIs. +To read more about the available transformations, check out [the official documentation](https://mxnet.incubator.apache.org/api/python/gluon/data.html#vision-transforms). + + +```python +transformers = [gluon.data.vision.transforms.Resize(224), # We pick 224 as the model we use takes an input of size 224. +gluon.data.vision.transforms.ToTensor(), +gluon.data.v
[GitHub] [incubator-mxnet] zachgk commented on issue #14348: [WIP][MXNET-1302, MXNET-1331] Backport fix to v1.3.x branch
zachgk commented on issue #14348: [WIP][MXNET-1302,MXNET-1331] Backport fix to v1.3.x branch URL: https://github.com/apache/incubator-mxnet/pull/14348#issuecomment-474137523 @perdasilva Can you help take a look at this? It seems to be failing on the Windows CI 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] piyushghai commented on issue #14462: [MXNET-1358][Fit API] Fit api tutorial
piyushghai commented on issue #14462: [MXNET-1358][Fit API] Fit api tutorial URL: https://github.com/apache/incubator-mxnet/pull/14462#issuecomment-474135267 @mxnet-label-bot Add [Gluon, pr-awaiting-review] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk commented on issue #14463: Enforce determinism for backwards compatibility checker
zachgk commented on issue #14463: Enforce determinism for backwards compatibility checker URL: https://github.com/apache/incubator-mxnet/pull/14463#issuecomment-474134710 @mxnet-label-bot add [CI] 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] wkcn commented on a change in pull request #13886: Fixes for wine detection tutorial
wkcn commented on a change in pull request #13886: Fixes for wine detection tutorial URL: https://github.com/apache/incubator-mxnet/pull/13886#discussion_r266675529 ## File path: docs/tutorials/embedded/wine_detector.md ## @@ -100,13 +101,14 @@ with open('synset.txt', 'r') as f: synsets = [l.rstrip() for l in f] # Load the network parameters -sym, arg_params, aux_params = mx.model.load_checkpoint('Inception_BN', 0) +sym, arg_params, aux_params = mx.model.load_checkpoint('Inception-BN', 126) Review comment: Agree. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] zachgk opened a new pull request #14463: Enforce determinism for backwards compatibility checker
zachgk opened a new pull request #14463: Enforce determinism for backwards compatibility checker URL: https://github.com/apache/incubator-mxnet/pull/14463 ## Description ## Adds the enforce determinism setting when running the backwards compatibility checker to avoid flaky issues due to non-deterministic operators. This was made based on discussion of #14234. @marcoabreu @piyushghai @samskalicky ## Checklist ## ### Essentials ### Please feel free to remove inapplicable items for your PR. - [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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] piyushghai opened a new pull request #14462: [MXNET-1358] Fit api tutorial
piyushghai opened a new pull request #14462: [MXNET-1358] Fit api tutorial URL: https://github.com/apache/incubator-mxnet/pull/14462 ## Description ## Added a simple tutorial showcasing the fit api usage. ## 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) Related PR for assets for the tutorial --> https://github.com/dmlc/web-data/pull/171 @roywei 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] anirudh2290 commented on issue #14451: fix custom operation in fork
anirudh2290 commented on issue #14451: fix custom operation in fork URL: https://github.com/apache/incubator-mxnet/pull/14451#issuecomment-474131945 I think this may be related to https://docs.python.org/3/c-api/init.html#non-python-created-threads . Quoting from the doc: > If you need to call Python code from these threads (often this will be part of a callback API provided by the aforementioned third-party library), you must first register these threads with the interpreter by creating a thread state data structure, then acquiring the GIL, and finally storing their thread state pointer, before you can start using the Python/C API. When you are done, you should reset the thread state pointer, release the GIL, and finally free the thread state data structure. We don't have any such handling for callbacks in custom ops. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] YutingZhang commented on issue #14451: fix custom operation in fork
YutingZhang commented on issue #14451: fix custom operation in fork URL: https://github.com/apache/incubator-mxnet/pull/14451#issuecomment-474129832 @arcadiaphy Does this also related to https://discuss.mxnet.io/t/custom-operator-cause-stuck-in-multicard-train/1452 Basically, a CustomOP could randomly get stuck in a multi-GPU setting. I also observed the same problem in my current experiment. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] apeforest commented on issue #10002: General support of OPs for second-order gradient
apeforest commented on issue #10002: General support of OPs for second-order gradient URL: https://github.com/apache/incubator-mxnet/issues/10002#issuecomment-474122803 @lonelykid We are actively working on the higher order gradient feature right now. We will update you once the PR is ready for review. Thanks for your patience. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] tlby opened a new pull request #14461: [MXNET-1359] Adds a multiclass-MCC metric derived from Pearson
tlby opened a new pull request #14461: [MXNET-1359] Adds a multiclass-MCC metric derived from Pearson URL: https://github.com/apache/incubator-mxnet/pull/14461 ## Description ## A multiclass metric equivalent to `mxnet.metric.MCC` can be derived from `mxnet.metric.PearsonCorrelation` with the addition of an `.argmax()` on preds. I'd like to document this use case of Pearson and provide it behind a metric named "PCC" to simplify extending examples from F1 and MCC to multiclass predictions. ## 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 the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change ### Changes ### - [ ] Feature1, tests, (and when applicable, API doc) - [ ] 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 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: us...@infra.apache.org With regards, Apache Git Services
[incubator-mxnet-site] branch asf-site updated: Bump the publish timestamp.
This is an automated email from the ASF dual-hosted git repository. zhasheng pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/incubator-mxnet-site.git The following commit(s) were added to refs/heads/asf-site by this push: new 40bfba8 Bump the publish timestamp. 40bfba8 is described below commit 40bfba8430ba7935c310248d41ee9298d199d60b Author: mxnet-ci AuthorDate: Mon Mar 18 20:53:35 2019 + Bump the publish timestamp. --- date.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/date.txt b/date.txt new file mode 100644 index 000..1a07a6a --- /dev/null +++ b/date.txt @@ -0,0 +1 @@ +Mon Mar 18 20:53:35 UTC 2019
[GitHub] [incubator-mxnet] eric-haibin-lin commented on a change in pull request #14449: GELU Operator
eric-haibin-lin commented on a change in pull request #14449: GELU Operator URL: https://github.com/apache/incubator-mxnet/pull/14449#discussion_r266635416 ## File path: src/operator/mshadow_op.h ## @@ -127,6 +131,20 @@ MXNET_UNARY_MATH_OP(softsign, a / (1.0f + math::fabs(a))); MXNET_UNARY_MATH_OP(softsign_grad, 1.0f / math::sqr(1.0f + math::fabs(a))); +#define gelu_gx(a) \ Review comment: Can we have MXNET_ as the prefix for the macro? thanks 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] eric-haibin-lin closed issue #14358: Memory builds up when creating size-zero NDArray in a loop
eric-haibin-lin closed issue #14358: Memory builds up when creating size-zero NDArray in a loop URL: https://github.com/apache/incubator-mxnet/issues/14358 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: us...@infra.apache.org With regards, Apache Git Services
[incubator-mxnet] branch master updated: Fix memory leak for size-zero ndarray (#14365)
This is an automated email from the ASF dual-hosted git repository. haibin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git The following commit(s) were added to refs/heads/master by this push: new 3ab1dec Fix memory leak for size-zero ndarray (#14365) 3ab1dec is described below commit 3ab1decd56563e20fefb5f3f8893abbab26f9cbf Author: Yuxi Hu AuthorDate: Mon Mar 18 13:43:25 2019 -0700 Fix memory leak for size-zero ndarray (#14365) * free memory for size zero storage handle * skip adding nullptr into GPU memory pool * set context for aux handle * set context for aux handle once it is created --- include/mxnet/ndarray.h | 15 +++ src/ndarray/ndarray.cc | 8 src/storage/pooled_storage_manager.h | 8 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/include/mxnet/ndarray.h b/include/mxnet/ndarray.h index c55cb01..2eed979 100644 --- a/include/mxnet/ndarray.h +++ b/include/mxnet/ndarray.h @@ -909,9 +909,6 @@ class NDArray { // aux_handles always reflect the correct number of aux data for (size_t i = 0; i < aux_shapes.size(); i++) { CheckAndAllocAuxData(i, aux_shapes[i]); -// this line is needed in case when aux_shapes[i].Size() = 0 -// aux_handles[i] will not be updated and take only default value. -aux_handles[i].ctx = ctx; } if (!delay_alloc) { CheckAndAllocData(storage_shape, dtype); @@ -986,8 +983,8 @@ class NDArray { #endif delay_alloc = false; } else if (shandle.size < dbytes) { -// free storage if necessary and alloc again -if (shandle.size > 0) Storage::Get()->Free(shandle); +// free storage +Storage::Get()->Free(shandle); // init storage shandle = Storage::Get()->Alloc(dbytes, shandle.ctx); #if MXNET_USE_MKLDNN == 1 @@ -1052,12 +1049,14 @@ class NDArray { << "storage type cannot be kDefaultStorage in CheckAndAllocAuxData"; if (aux_handles.size() <= i) { aux_handles.resize(i + 1); +// set context for the newly created aux handle +aux_handles[i].ctx = ctx; } size_t aux_bytes = shape.Size() * mshadow::mshadow_sizeof(aux_types[i]); if (aux_handles[i].size < aux_bytes) { -// free storage if necessary and alloc again -if (aux_handles[i].size > 0) Storage::Get()->Free(aux_handles[i]); -// init aux storage +// free storage +Storage::Get()->Free(aux_handles[i]); +// init storage aux_handles[i] = Storage::Get()->Alloc(aux_bytes, ctx); } // init shape diff --git a/src/ndarray/ndarray.cc b/src/ndarray/ndarray.cc index 3677127..377bef0 100644 --- a/src/ndarray/ndarray.cc +++ b/src/ndarray/ndarray.cc @@ -121,9 +121,9 @@ NDArray::Chunk::~Chunk() { CHECK_EQ(mem.mem->GetDataHandle(), mem.h.dptr); } #endif - if (mem.h.size > 0) Storage::Get()->Free(mem.h); + Storage::Get()->Free(mem.h); for (const auto& aux : mem.aux_h) { -if (aux.size > 0) Storage::Get()->Free(aux); +Storage::Get()->Free(aux); } } }, shandle.ctx, var); @@ -134,8 +134,8 @@ void NDArray::Chunk::CheckAndAllocData(const mxnet::TShape &shape, int dtype) { << "data is expected to be allocated after aux_data"; auto dbytes = shape.Size() * mshadow::mshadow_sizeof(dtype); if (shandle.size < dbytes) { -// free storage if necessary and alloc again -if (shandle.size > 0) Storage::Get()->Free(shandle); +// free storage +Storage::Get()->Free(shandle); // init storage shandle = Storage::Get()->Alloc(dbytes, ctx); #if MXNET_USE_MKLDNN == 1 diff --git a/src/storage/pooled_storage_manager.h b/src/storage/pooled_storage_manager.h index c407a9f..7c4b070 100644 --- a/src/storage/pooled_storage_manager.h +++ b/src/storage/pooled_storage_manager.h @@ -155,6 +155,10 @@ void GPUPooledStorageManager::Alloc(Storage::Handle* handle) { } void GPUPooledStorageManager::Free(Storage::Handle handle) { + // Do nothing if dptr is nullptr. Otherwise, nullptr may be reused + // which can cause illegal memory access error. + if (handle.dptr == nullptr) return; + std::lock_guard lock(Storage::Get()->GetMutex(Context::kGPU)); size_t size = RoundAllocSize(handle.size); auto&& reuse_pool = memory_pool_[size]; @@ -312,6 +316,10 @@ void GPUPooledRoundedStorageManager::Alloc(Storage::Handle* handle) { } void GPUPooledRoundedStorageManager::Free(Storage::Handle handle) { + // Do nothing if dptr is nullptr. Otherwise, nullptr may be reused + // which can cause illegal memory access error. + if (handle.dptr == nullptr) return; + std::lock_guard lock(Storage::Get()->GetMutex(Context::kGPU)); int bucket = get_bucket(handle.size); auto&& reuse_pool = memory_pool_[bucket];
[GitHub] [incubator-mxnet] eric-haibin-lin closed issue #13951: Gluon RNN memory leaks with extra variables
eric-haibin-lin closed issue #13951: Gluon RNN memory leaks with extra variables URL: https://github.com/apache/incubator-mxnet/issues/13951 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] eric-haibin-lin merged pull request #14365: Fix memory leak for size-zero ndarray
eric-haibin-lin merged pull request #14365: Fix memory leak for size-zero ndarray URL: https://github.com/apache/incubator-mxnet/pull/14365 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] haojin2 commented on issue #14449: GELU Operator
haojin2 commented on issue #14449: GELU Operator URL: https://github.com/apache/incubator-mxnet/pull/14449#issuecomment-474090439 @szha Gluon test added, also fixed a problem with existing SELU test. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] abhinavs95 commented on a change in pull request #14405: [MXNet-1343][WIP][Fit API]Add CNN integration test for fit() API
abhinavs95 commented on a change in pull request #14405: [MXNet-1343][WIP][Fit API]Add CNN integration test for fit() API URL: https://github.com/apache/incubator-mxnet/pull/14405#discussion_r266624361 ## File path: tests/nightly/estimator/test_estimator_cnn_gpu.py ## @@ -0,0 +1,94 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Test gluon estimator on GPU using ResNet18 + +import os +import sys +import mxnet as mx +from mxnet import gluon +from mxnet.gluon import data +from mxnet.gluon.estimator import estimator, event_handler +from mxnet.gluon.model_zoo import vision + +def load_data_mnist(batch_size, resize=None, num_workers=None, +root=os.path.join('~', '.mxnet', 'datasets', 'mnist')): Review comment: Done! 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] abhinavs95 commented on a change in pull request #14405: [MXNet-1343][WIP][Fit API]Add CNN integration test for fit() API
abhinavs95 commented on a change in pull request #14405: [MXNet-1343][WIP][Fit API]Add CNN integration test for fit() API URL: https://github.com/apache/incubator-mxnet/pull/14405#discussion_r266624285 ## File path: tests/nightly/estimator/test_estimator_cnn_cpu.py ## @@ -0,0 +1,104 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Test gluon estimator on CPU using CNN models + +import numpy as np +import mxnet as mx +from mxnet import gluon, init, nd +from mxnet.gluon.estimator import estimator, event_handler +from mxnet.gluon.model_zoo import vision + +def bilinear_kernel(in_channels, out_channels, kernel_size): +''' +Bilinear interpolation using transposed convolution +''' +factor = (kernel_size + 1) // 2 +if kernel_size % 2 == 1: +center = factor - 1 +else: +center = factor - 0.5 +og = np.ogrid[:kernel_size, :kernel_size] +filt = (1 - abs(og[0] - center) / factor) * (1 - abs(og[1] - center) / factor) +weight = np.zeros((in_channels, out_channels, kernel_size, kernel_size), dtype='float32') +weight[range(in_channels), range(out_channels), :, :] = filt +return nd.array(weight) + +def FCN(num_classes=21, ctx=None): +''' +FCN model for semantic segmentation +''' +pretrained_net = vision.resnet18_v2(pretrained=True, ctx=ctx) + +net = gluon.nn.HybridSequential() +for layer in pretrained_net.features[:-2]: +net.add(layer) + +net.add(gluon.nn.Conv2D(num_classes, kernel_size=1), +gluon.nn.Conv2DTranspose(num_classes, kernel_size=64, padding=16, strides=32)) +return net + +def test_estimator(): +''' +Test estimator by doing one pass over each model with synthetic data +''' +models = ['resnet18_v1', + 'alexnet', + 'FCN' + ] +context = mx.cpu() +for model_name in models: +batch_size = 1 +num_epochs = 1 +lr = 0.001 +# Get model +if model_name is 'FCN': +num_classes = 21 +net = FCN(num_classes=num_classes, ctx=context) +dataset = gluon.data.dataset.ArrayDataset(mx.nd.random.uniform(shape=(batch_size, 3, 320, 480)), + mx.nd.zeros(shape=(batch_size, 320, 480))) +loss = gluon.loss.SoftmaxCrossEntropyLoss(axis=1) +net[-1].initialize(init.Constant(bilinear_kernel(num_classes, num_classes, 64)), ctx=context) +net[-2].initialize(init=init.Xavier(), ctx=context) +else: +net = vision.get_model(model_name, classes=10) +dataset = gluon.data.dataset.ArrayDataset(mx.nd.random.uniform(shape=(batch_size, 1, 224, 224)), + mx.nd.zeros(batch_size)) +loss = gluon.loss.SoftmaxCrossEntropyLoss() +net.initialize(mx.init.MSRAPrelu(), ctx=context) Review comment: Changed to Xavier initializer 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: us...@infra.apache.org With regards, Apache Git Services