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

Commit

Permalink
Move legacy operators under the nn directory (#8858)
Browse files Browse the repository at this point in the history
* Move legacy operators to nn/

* Move CuDNN operators to nn/

* Update CuDNN algoreg.

* fix amalgamation.

* fix a path of a header file.

* Fix the path for mkl header files.

* Fix compilation errors in mkl.

* Fix for the coding style.

* Fix the path of the header files.

* Fix headers in the cu files.

* Compile cu files.

* Update activation-inl.h

* Update activation-inl.h
  • Loading branch information
zheng-da authored and piiswrong committed Nov 30, 2017
1 parent cabbcff commit 2aa506a
Show file tree
Hide file tree
Showing 44 changed files with 117 additions and 117 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ endif

all: lib/libmxnet.a lib/libmxnet.so $(BIN) extra-packages

SRC = $(wildcard src/*/*/*.cc src/*/*.cc src/*.cc)
SRC = $(wildcard src/*/*/*/*.cc src/*/*/*.cc src/*/*.cc src/*.cc)
OBJ = $(patsubst %.cc, build/%.o, $(SRC))
CUSRC = $(wildcard src/*/*/*.cu src/*/*.cu src/*.cu)
CUSRC = $(wildcard src/*/*/*/*.cu src/*/*/*.cu src/*/*.cu src/*.cu)
CUOBJ = $(patsubst %.cu, build/%_gpu.o, $(CUSRC))

# extra operators
Expand Down
16 changes: 8 additions & 8 deletions amalgamation/mxnet_predict0.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@

#include "src/operator/operator.cc"
#include "src/operator/operator_util.cc"
#include "src/operator/activation.cc"
#include "src/operator/batch_norm.cc"
#include "src/operator/nn/activation.cc"
#include "src/operator/nn/batch_norm.cc"
#include "src/operator/concat.cc"
#include "src/operator/convolution.cc"
#include "src/operator/deconvolution.cc"
#include "src/operator/dropout.cc"
#include "src/operator/fully_connected.cc"
#include "src/operator/nn/convolution.cc"
#include "src/operator/nn/deconvolution.cc"
#include "src/operator/nn/dropout.cc"
#include "src/operator/nn/fully_connected.cc"
#include "src/operator/leaky_relu.cc"
#include "src/operator/pooling.cc"
#include "src/operator/softmax_activation.cc"
#include "src/operator/nn/pooling.cc"
#include "src/operator/nn/softmax_activation.cc"
#include "src/operator/softmax_output.cc"
#include "src/operator/tensor/elemwise_binary_broadcast_op_basic.cc"
#include "src/operator/tensor/elemwise_binary_op.cc"
Expand Down
2 changes: 1 addition & 1 deletion src/operator/convolution_v1.cu
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "./convolution_v1-inl.h"
#include <vector>
#if MXNET_USE_CUDNN == 1
#include "./cudnn_convolution-inl.h"
#include "./nn/cudnn/cudnn_convolution-inl.h"
#endif // MXNET_USE_CUDNN

namespace mxnet {
Expand Down
2 changes: 1 addition & 1 deletion src/operator/mkl/mkl_convolution-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <string>
#include <utility>
#include "../operator_common.h"
#include "../convolution-inl.h"
#include "../nn/convolution-inl.h"
#include "./mkl_util-inl.h"

namespace mxnet {
Expand Down
2 changes: 1 addition & 1 deletion src/operator/mkl/mkl_pooling-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <string>
#include <utility>
#include "../operator_common.h"
#include "../pooling-inl.h"
#include "../nn/pooling-inl.h"
#include "./mkl_util-inl.h"

namespace mxnet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
* \author Bing Xu
*/

#ifndef MXNET_OPERATOR_ACTIVATION_INL_H_
#define MXNET_OPERATOR_ACTIVATION_INL_H_
#ifndef MXNET_OPERATOR_NN_ACTIVATION_INL_H_
#define MXNET_OPERATOR_NN_ACTIVATION_INL_H_

#include <dmlc/logging.h>
#include <dmlc/parameter.h>
Expand All @@ -35,8 +35,8 @@
#include <string>
#include <vector>
#include <utility>
#include "./operator_common.h"
#include "./mxnet_op.h"
#include "../operator_common.h"
#include "../mxnet_op.h"

namespace mxnet {
namespace op {
Expand Down Expand Up @@ -215,4 +215,4 @@ class ActivationProp : public OperatorProperty {
#endif // DMLC_USE_CXX11
} // namespace op
} // namespace mxnet
#endif // MXNET_OPERATOR_ACTIVATION_INL_H_
#endif // MXNET_OPERATOR_NN_ACTIVATION_INL_H_
6 changes: 3 additions & 3 deletions src/operator/activation.cc → src/operator/nn/activation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
* \author Bing Xu
*/
#include "./activation-inl.h"
#include "./mshadow_op.h"
#include "../mshadow_op.h"
#if MXNET_USE_MKL2017 == 1
#include <mkl_memory.h>
#include "./mkl/mkl_memory-inl.h"
#include "./mkl/mkl_relu-inl.h"
#include "../mkl/mkl_memory-inl.h"
#include "../mkl/mkl_relu-inl.h"
#endif // MXNET_USE_MKL2017

namespace mxnet {
Expand Down
4 changes: 2 additions & 2 deletions src/operator/activation.cu → src/operator/nn/activation.cu
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
* \author Bing Xu
*/
#include "./activation-inl.h"
#include "./mshadow_op.h"
#include "../mshadow_op.h"
#if MXNET_USE_CUDNN == 1
#include "./cudnn_activation-inl.h"
#include "./cudnn/cudnn_activation-inl.h"
#endif

namespace mxnet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
* \brief
* \author Bing Xu, Chris Olivier
*/
#ifndef MXNET_OPERATOR_BATCH_NORM_INL_H_
#define MXNET_OPERATOR_BATCH_NORM_INL_H_
#ifndef MXNET_OPERATOR_NN_BATCH_NORM_INL_H_
#define MXNET_OPERATOR_NN_BATCH_NORM_INL_H_

#include <dmlc/logging.h>
#include <dmlc/parameter.h>
Expand All @@ -34,9 +34,9 @@
#include <vector>
#include <string>
#include <utility>
#include "./mshadow_op.h"
#include "./operator_common.h"
#include "mxnet_op.h"
#include "../mshadow_op.h"
#include "../operator_common.h"
#include "../mxnet_op.h"

#ifdef __GNUG__
#pragma GCC diagnostic push
Expand Down Expand Up @@ -489,5 +489,5 @@ extern volatile bool disable_mkl;
#pragma GCC diagnostic pop
#endif

#endif // MXNET_OPERATOR_BATCH_NORM_INL_H_
#endif // MXNET_OPERATOR_NN_BATCH_NORM_INL_H_

4 changes: 2 additions & 2 deletions src/operator/batch_norm.cc → src/operator/nn/batch_norm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include <nnvm/op_attr_types.h>
#if MXNET_USE_MKL2017 == 1
#include <mkl_memory.h>
#include "./mkl/mkl_memory-inl.h"
#include "./mkl/mkl_batch_norm-inl.h"
#include "../mkl/mkl_memory-inl.h"
#include "../mkl/mkl_batch_norm-inl.h"
#endif // MXNET_USE_MKL2017

/*! \brief inverse standard deviation <-> variance */
Expand Down
4 changes: 2 additions & 2 deletions src/operator/batch_norm.cu → src/operator/nn/batch_norm.cu
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
#define USE_GLOBAL_STATS_FLAG 32

#if MXNET_USE_CUDNN == 1 && CUDNN_MAJOR >= 5
#include "./cudnn_batch_norm-inl.h"
#include "./cudnn/cudnn_batch_norm-inl.h"
#endif

#include "../common/cuda_utils.h"
#include "../../common/cuda_utils.h"

using namespace mxnet;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
* \ref: https://github.com/Yangqing/caffe/wiki/Convolution-in-Caffe:-a-memo
* \author Bing Xu, Jun Wu
*/
#ifndef MXNET_OPERATOR_CONVOLUTION_INL_H_
#define MXNET_OPERATOR_CONVOLUTION_INL_H_
#ifndef MXNET_OPERATOR_NN_CONVOLUTION_INL_H_
#define MXNET_OPERATOR_NN_CONVOLUTION_INL_H_

#include <mxnet/io.h>
#include <mxnet/base.h>
Expand All @@ -39,9 +39,9 @@
#include <vector>
#include <string>
#include <utility>
#include "./operator_common.h"
#include "./nn/im2col.h"
#include "./linalg.h"
#include "../operator_common.h"
#include "../linalg.h"
#include "./im2col.h"


namespace mxnet {
Expand Down Expand Up @@ -681,4 +681,4 @@ class ConvolutionProp : public OperatorProperty {
#endif // DMLC_USE_CXX11
} // namespace op
} // namespace mxnet
#endif // MXNET_OPERATOR_CONVOLUTION_INL_H_
#endif // MXNET_OPERATOR_NN_CONVOLUTION_INL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include "./convolution-inl.h"
#if MXNET_USE_MKL2017 == 1
#include <mkl_memory.h>
#include "./mkl/mkl_memory-inl.h"
#include "./mkl/mkl_convolution-inl.h"
#include "../mkl/mkl_memory-inl.h"
#include "../mkl/mkl_convolution-inl.h"
#endif // MXNET_USE_MKL2017
#if MXNET_USE_NNPACK == 1
#include "./nnpack/nnpack_convolution-inl.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "./convolution-inl.h"
#include <vector>
#if MXNET_USE_CUDNN == 1
#include "./cudnn_convolution-inl.h"
#include "./cudnn/cudnn_convolution-inl.h"
#endif // MXNET_USE_CUDNN

#include "./depthwise_convolution-inl.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
* \author Bing Xu
*/

#ifndef MXNET_OPERATOR_CUDNN_ACTIVATION_INL_H_
#define MXNET_OPERATOR_CUDNN_ACTIVATION_INL_H_
#ifndef MXNET_OPERATOR_NN_CUDNN_CUDNN_ACTIVATION_INL_H_
#define MXNET_OPERATOR_NN_CUDNN_CUDNN_ACTIVATION_INL_H_
#include <algorithm>
#include <vector>
#include "./activation-inl.h"
#include "../activation-inl.h"

namespace mxnet {
namespace op {
Expand Down Expand Up @@ -225,4 +225,4 @@ class CuDNNActivationOp : public Operator {
}; // class CuDNNActivationOp
} // namespace op
} // namespace mxnet
#endif // MXNET_OPERATOR_CUDNN_ACTIVATION_INL_H_
#endif // MXNET_OPERATOR_NN_CUDNN_CUDNN_ACTIVATION_INL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
* \brief
* \author Bing Xu
*/
#ifndef MXNET_OPERATOR_CUDNN_ALGOREG_INL_H_
#define MXNET_OPERATOR_CUDNN_ALGOREG_INL_H_
#ifndef MXNET_OPERATOR_NN_CUDNN_CUDNN_ALGOREG_INL_H_
#define MXNET_OPERATOR_NN_CUDNN_CUDNN_ALGOREG_INL_H_

#include <algorithm>
#include <mutex>
#include <string>
#include <vector>
#include "../common/cuda_utils.h"
#include "./convolution-inl.h"
#include "./deconvolution-inl.h"
#include "../../../common/cuda_utils.h"
#include "../convolution-inl.h"
#include "../deconvolution-inl.h"
namespace mxnet {
namespace op {
#if MXNET_USE_CUDNN == 1
Expand Down Expand Up @@ -175,4 +175,4 @@ typedef CuDNNAlgoReg<DeconvolutionParam> CuDNNDeconvAlgoReg;
} // namespace op
} // namespace mxnet

#endif // MXNET_OPERATOR_CUDNN_ALGOREG_INL_H_
#endif // MXNET_OPERATOR_NN_CUDNN_CUDNN_ALGOREG_INL_H_
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
* \author Junyuan Xie
*/

#ifndef MXNET_OPERATOR_CUDNN_BATCH_NORM_INL_H_
#define MXNET_OPERATOR_CUDNN_BATCH_NORM_INL_H_
#ifndef MXNET_OPERATOR_NN_CUDNN_CUDNN_BATCH_NORM_INL_H_
#define MXNET_OPERATOR_NN_CUDNN_CUDNN_BATCH_NORM_INL_H_
#include <vector>
#include <map>
#include <string>
#include <utility>
#include "batch_norm-inl.h"
#include "../batch_norm-inl.h"

namespace mxnet {
namespace op {
Expand Down Expand Up @@ -387,4 +387,4 @@ class CuDNNBatchNormProp : public OperatorProperty {
#endif // MXNET_USE_CUDNN == 1 && CUDNN_MAJOR >= 4
} // namespace op
} // namespace mxnet
#endif // MXNET_OPERATOR_CUDNN_BATCH_NORM_INL_H_
#endif // MXNET_OPERATOR_NN_CUDNN_CUDNN_BATCH_NORM_INL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
* \brief
* \author Bing Xu
*/
#ifndef MXNET_OPERATOR_CUDNN_CONVOLUTION_INL_H_
#define MXNET_OPERATOR_CUDNN_CONVOLUTION_INL_H_
#ifndef MXNET_OPERATOR_NN_CUDNN_CUDNN_CONVOLUTION_INL_H_
#define MXNET_OPERATOR_NN_CUDNN_CUDNN_CONVOLUTION_INL_H_

#include <algorithm>
#include <vector>
#include <mutex>
#include <string>
#include "./convolution-inl.h"
#include "../convolution-inl.h"
#include "./cudnn_algoreg-inl.h"
#include "../common/cuda_utils.h"
#include "../../../common/cuda_utils.h"

namespace mxnet {
namespace op {
Expand Down Expand Up @@ -912,4 +912,4 @@ class CuDNNConvolutionOp : public Operator {
} // namespace op
} // namespace mxnet

#endif // MXNET_OPERATOR_CUDNN_CONVOLUTION_INL_H_
#endif // MXNET_OPERATOR_NN_CUDNN_CUDNN_CONVOLUTION_INL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
* \brief
* \author Wei Wu, Leonard Lausen
*/
#ifndef MXNET_OPERATOR_CUDNN_DECONVOLUTION_INL_H_
#define MXNET_OPERATOR_CUDNN_DECONVOLUTION_INL_H_
#ifndef MXNET_OPERATOR_NN_CUDNN_CUDNN_DECONVOLUTION_INL_H_
#define MXNET_OPERATOR_NN_CUDNN_CUDNN_DECONVOLUTION_INL_H_

#include <algorithm>
#include <vector>
#include <mutex>
#include <string>
#include "./deconvolution-inl.h"
#include "../deconvolution-inl.h"
#include "./cudnn_algoreg-inl.h"
#include "../common/cuda_utils.h"
#include "../../../common/cuda_utils.h"

namespace mxnet {
namespace op {
Expand Down Expand Up @@ -951,4 +951,4 @@ class CuDNNDeconvolutionOp : public Operator {
} // namespace op
} // namespace mxnet

#endif // MXNET_OPERATOR_CUDNN_DECONVOLUTION_INL_H_
#endif // MXNET_OPERATOR_NN_CUDNN_CUDNN_DECONVOLUTION_INL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
* \author Bing Xu
*/

#ifndef MXNET_OPERATOR_CUDNN_POOLING_INL_H_
#define MXNET_OPERATOR_CUDNN_POOLING_INL_H_
#ifndef MXNET_OPERATOR_NN_CUDNN_CUDNN_POOLING_INL_H_
#define MXNET_OPERATOR_NN_CUDNN_CUDNN_POOLING_INL_H_
#include <algorithm>
#include <vector>
#include "./pooling-inl.h"
#include "../pooling-inl.h"

namespace mxnet {
namespace op {
Expand Down Expand Up @@ -311,5 +311,5 @@ class CuDNNPoolingOp : public Operator {
} // namespace op
} // namespace mxnet

#endif // MXNET_OPERATOR_CUDNN_POOLING_INL_H_
#endif // MXNET_OPERATOR_NN_CUDNN_CUDNN_POOLING_INL_H_

Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
* \author Bing Xu
*/

#ifndef MXNET_OPERATOR_CUDNN_SOFTMAX_ACTIVATION_INL_H_
#define MXNET_OPERATOR_CUDNN_SOFTMAX_ACTIVATION_INL_H_
#ifndef MXNET_OPERATOR_NN_CUDNN_CUDNN_SOFTMAX_ACTIVATION_INL_H_
#define MXNET_OPERATOR_NN_CUDNN_CUDNN_SOFTMAX_ACTIVATION_INL_H_
#include <algorithm>
#include <vector>
#include "./softmax_activation-inl.h"
#include "../softmax_activation-inl.h"

namespace mxnet {
namespace op {
Expand Down Expand Up @@ -181,4 +181,4 @@ class CuDNNSoftmaxActivationOp : public Operator {
}; // class CuDNNSoftmaxActivationOp
} // namespace op
} // namespace mxnet
#endif // MXNET_OPERATOR_CUDNN_SOFTMAX_ACTIVATION_INL_H_
#endif // MXNET_OPERATOR_NN_CUDNN_CUDNN_SOFTMAX_ACTIVATION_INL_H_
Loading

0 comments on commit 2aa506a

Please sign in to comment.