Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Refactor Stateful operator and custom op #6928

Merged
merged 19 commits into from
Jul 12, 2017
12 changes: 10 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,21 @@ del /Q *.7z
// Python unittest for CPU
def python_ut(docker_type) {
timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ${docker_type} find . -name '*.pyc' -type f -delete"
sh "${docker_run} ${docker_type} PYTHONPATH=./python/ nosetests --with-timer --verbose tests/python/unittest"
sh "${docker_run} ${docker_type} PYTHONPATH=./python/ nosetests-3.4 --with-timer --verbose tests/python/unittest"
sh "${docker_run} ${docker_type} PYTHONPATH=./python/ nosetests --with-timer --verbose tests/python/train"
sh "${docker_run} ${docker_type} find . -name '*.pyc' -type f -delete"
sh "${docker_run} ${docker_type} PYTHONPATH=./python/ nosetests-3.4 --with-timer --verbose tests/python/unittest"
}
}

// GPU test has two parts. 1) run unittest on GPU, 2) compare the results on
// both CPU and GPU
def python_gpu_ut(docker_type) {
timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} ${docker_type} find . -name '*.pyc' -type f -delete"
sh "${docker_run} ${docker_type} PYTHONPATH=./python/ nosetests --with-timer --verbose tests/python/gpu"
sh "${docker_run} ${docker_type} find . -name '*.pyc' -type f -delete"
sh "${docker_run} ${docker_type} PYTHONPATH=./python/ nosetests-3.4 --with-timer --verbose tests/python/gpu"
}
}
Expand Down Expand Up @@ -312,11 +316,13 @@ stage('Unit Test') {
xcopy C:\\mxnet\\model model /E /I /Y
call activate py3
set PYTHONPATH=${env.WORKSPACE}\\pkg_vc14_cpu\\python
del /S /Q ${env.WORKSPACE}\\pkg_vc14_cpu\\python\\*.pyc
C:\\mxnet\\test_cpu.bat"""
bat """xcopy C:\\mxnet\\data data /E /I /Y
xcopy C:\\mxnet\\model model /E /I /Y
call activate py2
set PYTHONPATH=${env.WORKSPACE}\\pkg_vc14_cpu\\python
del /S /Q ${env.WORKSPACE}\\pkg_vc14_cpu\\python\\*.pyc
C:\\mxnet\\test_cpu.bat"""
}
}
Expand All @@ -332,11 +338,13 @@ C:\\mxnet\\test_cpu.bat"""
xcopy C:\\mxnet\\model model /E /I /Y
call activate py3
set PYTHONPATH=${env.WORKSPACE}\\pkg_vc14_gpu\\python
del /S /Q ${env.WORKSPACE}\\pkg_vc14_gpu\\python\\*.pyc
C:\\mxnet\\test_gpu.bat"""
bat """xcopy C:\\mxnet\\data data /E /I /Y
xcopy C:\\mxnet\\model model /E /I /Y
call activate py2
set PYTHONPATH=${env.WORKSPACE}\\pkg_vc14_gpu\\python
del /S /Q ${env.WORKSPACE}\\pkg_vc14_gpu\\python\\*.pyc
C:\\mxnet\\test_gpu.bat"""
}
}
Expand Down Expand Up @@ -390,4 +398,4 @@ stage('Deploy') {
}
}
}
}
}
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/MxNetCpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Chuntao Hong, Zhang Chen
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_MXNETCPP_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_MXNETCPP_H_
#ifndef MXNET_CPP_MXNETCPP_H_
#define MXNET_CPP_MXNETCPP_H_

#include "mxnet-cpp/executor.hpp"
#include "mxnet-cpp/symbol.hpp"
Expand All @@ -21,4 +21,4 @@
#include "mxnet-cpp/metric.h"
#include "mxnet-cpp/initializer.h"

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_MXNETCPP_H_
#endif // MXNET_CPP_MXNETCPP_H_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Chuntao Hong, Zhang Chen
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_BASE_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_BASE_H_
#ifndef MXNET_CPP_BASE_H_
#define MXNET_CPP_BASE_H_

#include <cstdlib>
#include "mxnet/c_api.h"
Expand Down Expand Up @@ -35,4 +35,4 @@ enum OpReqType {
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_BASE_H_
#endif // MXNET_CPP_BASE_H_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Chuntao Hong, Zhang Chen
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_EXECUTOR_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_EXECUTOR_H_
#ifndef MXNET_CPP_EXECUTOR_H_
#define MXNET_CPP_EXECUTOR_H_

#include <vector>
#include <map>
Expand Down Expand Up @@ -135,4 +135,4 @@ class Executor {
};
} // namespace cpp
} // namespace mxnet
#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_EXECUTOR_H_
#endif // MXNET_CPP_EXECUTOR_H_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Zhang Chen, Chuntao Hong
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_EXECUTOR_HPP_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_EXECUTOR_HPP_
#ifndef MXNET_CPP_EXECUTOR_HPP_
#define MXNET_CPP_EXECUTOR_HPP_

#include <vector>
#include <map>
Expand Down Expand Up @@ -89,4 +89,4 @@ inline void Executor::UpdateAll(Optimizer *opt, float lr, float wd,
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_EXECUTOR_HPP_
#endif // MXNET_CPP_EXECUTOR_HPP_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/initializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Zhang Chen
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_INITIALIZER_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_INITIALIZER_H_
#ifndef MXNET_CPP_INITIALIZER_H_
#define MXNET_CPP_INITIALIZER_H_

#include <cmath>
#include <string>
Expand Down Expand Up @@ -179,4 +179,4 @@ class Xavier : public Initializer {
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_INITIALIZER_H_
#endif // MXNET_CPP_INITIALIZER_H_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* \brief definition of io, such as DataIter
* \author Zhang Chen
*/
#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_IO_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_IO_H_
#ifndef MXNET_CPP_IO_H_
#define MXNET_CPP_IO_H_

#include <map>
#include <string>
Expand Down Expand Up @@ -124,5 +124,5 @@ class MXDataIter : public DataIter {
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_IO_H_
#endif // MXNET_CPP_IO_H_

6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* \brief implementation of data iter
* \author Zhang Chen
*/
#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_IO_HPP_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_IO_HPP_
#ifndef MXNET_CPP_IO_HPP_
#define MXNET_CPP_IO_HPP_

#include <string>
#include <vector>
Expand Down Expand Up @@ -86,5 +86,5 @@ inline MXDataIter MXDataIter::CreateDataIter() {
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_IO_HPP_
#endif // MXNET_CPP_IO_HPP_

6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/kvstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Chuntao Hong
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_KVSTORE_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_KVSTORE_H_
#ifndef MXNET_CPP_KVSTORE_H_
#define MXNET_CPP_KVSTORE_H_

#include <string>
#include <vector>
Expand Down Expand Up @@ -46,4 +46,4 @@ class KVStore {
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_KVSTORE_H_
#endif // MXNET_CPP_KVSTORE_H_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/kvstore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "mxnet-cpp/kvstore.h"
#include "mxnet-cpp/optimizer.h"

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_KVSTORE_HPP_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_KVSTORE_HPP_
#ifndef MXNET_CPP_KVSTORE_HPP_
#define MXNET_CPP_KVSTORE_HPP_

namespace mxnet {
namespace cpp {
Expand Down Expand Up @@ -175,4 +175,4 @@ inline std::string KVStore::GetRole() {
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_KVSTORE_HPP_
#endif // MXNET_CPP_KVSTORE_HPP_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/metric.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Zhang Chen
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_METRIC_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_METRIC_H_
#ifndef MXNET_CPP_METRIC_H_
#define MXNET_CPP_METRIC_H_

#include <cmath>
#include <string>
Expand Down Expand Up @@ -187,5 +187,5 @@ class PSNR : public EvalMetric {
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_METRIC_H_
#endif // MXNET_CPP_METRIC_H_

6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Zhang Chen
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_MODEL_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_MODEL_H_
#ifndef MXNET_CPP_MODEL_H_
#define MXNET_CPP_MODEL_H_

#include <string>
#include <vector>
Expand Down Expand Up @@ -54,5 +54,5 @@ class FeedForward {
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_MODEL_H_
#endif // MXNET_CPP_MODEL_H_

6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Xin Li
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_MONITOR_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_MONITOR_H_
#ifndef MXNET_CPP_MONITOR_H_
#define MXNET_CPP_MONITOR_H_

#include <regex>
#include <tuple>
Expand Down Expand Up @@ -85,4 +85,4 @@ class Monitor {

} // namespace cpp
} // namespace mxnet
#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_MONITOR_H_
#endif // MXNET_CPP_MONITOR_H_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/monitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Xin Li
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_MONITOR_HPP_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_MONITOR_HPP_
#ifndef MXNET_CPP_MONITOR_HPP_
#define MXNET_CPP_MONITOR_HPP_

#include <cmath>
#include <sstream>
Expand Down Expand Up @@ -103,4 +103,4 @@ inline void Monitor::executor_callback(const char *name, NDArrayHandle handle,

} // namespace cpp
} // namespace mxnet
#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_MONITOR_HPP_
#endif // MXNET_CPP_MONITOR_HPP_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/ndarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Chuntao Hong, Zhang Chen
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_NDARRAY_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_NDARRAY_H_
#ifndef MXNET_CPP_NDARRAY_H_
#define MXNET_CPP_NDARRAY_H_

#include <map>
#include <memory>
Expand Down Expand Up @@ -428,4 +428,4 @@ std::ostream& operator<<(std::ostream& out, const NDArray &ndarray);
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_NDARRAY_H_
#endif // MXNET_CPP_NDARRAY_H_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/ndarray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Zhang Chen, Chuntao Hong
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_NDARRAY_HPP_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_NDARRAY_HPP_
#ifndef MXNET_CPP_NDARRAY_HPP_
#define MXNET_CPP_NDARRAY_HPP_

#include <algorithm>
#include <map>
Expand Down Expand Up @@ -378,4 +378,4 @@ inline std::ostream & operator<<(std::ostream &out, const NDArray &ndarray) {
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_NDARRAY_HPP_
#endif // MXNET_CPP_NDARRAY_HPP_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/op_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Chuntao Hong
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_OP_MAP_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_OP_MAP_H_
#ifndef MXNET_CPP_OP_MAP_H_
#define MXNET_CPP_OP_MAP_H_

#include <map>
#include <string>
Expand Down Expand Up @@ -89,4 +89,4 @@ class OpMap {
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_OP_MAP_H_
#endif // MXNET_CPP_OP_MAP_H_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/op_suppl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Zhang Chen, zhubuntu, Xin Li
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_OP_SUPPL_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_OP_SUPPL_H_
#ifndef MXNET_CPP_OP_SUPPL_H_
#define MXNET_CPP_OP_SUPPL_H_

#include <cassert>
#include <string>
Expand Down Expand Up @@ -157,5 +157,5 @@ inline Symbol Activation(const std::string& symbol_name,
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_OP_SUPPL_H_
#endif // MXNET_CPP_OP_SUPPL_H_

6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/op_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Chris Olivier
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_OP_UTIL_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_OP_UTIL_H_
#ifndef MXNET_CPP_OP_UTIL_H_
#define MXNET_CPP_OP_UTIL_H_

#include <string>

Expand Down Expand Up @@ -43,4 +43,4 @@ inline StreamType& operator << (StreamType& os, const ::caffe::LayerParameter& o
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_OP_UTIL_H_
#endif // MXNET_CPP_OP_UTIL_H_
6 changes: 3 additions & 3 deletions cpp-package/include/mxnet-cpp/operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* \author Chuntao Hong, Zhang Chen
*/

#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_OPERATOR_H_
#define CPP_PACKAGE_INCLUDE_MXNET_CPP_OPERATOR_H_
#ifndef MXNET_CPP_OPERATOR_H_
#define MXNET_CPP_OPERATOR_H_

#include <map>
#include <string>
Expand Down Expand Up @@ -188,4 +188,4 @@ class Operator {
} // namespace cpp
} // namespace mxnet

#endif // CPP_PACKAGE_INCLUDE_MXNET_CPP_OPERATOR_H_
#endif // MXNET_CPP_OPERATOR_H_