From 2becd7641fbe264b72425fe6b1ded00cea19d3a8 Mon Sep 17 00:00:00 2001 From: Kellen Sunderland Date: Thu, 20 Sep 2018 14:49:54 -0700 Subject: [PATCH] [MXNET-860] Update to modern nullptr usage (#12352) * [MXNET-860] Update to modern nullptr usage * [MXNET-860] Add nullptr rule to .clang-tidy rules --- .clang-tidy | 2 +- src/c_api/c_api_executor.cc | 2 +- src/io/iter_image_det_recordio.cc | 4 ++-- src/io/iter_image_recordio.cc | 2 +- src/io/iter_image_recordio_2.cc | 6 +++--- src/io/iter_mnist.cc | 4 ++-- src/ndarray/ndarray.cc | 2 +- src/operator/bilinear_sampler.cc | 2 +- src/operator/contrib/count_sketch.cc | 2 +- src/operator/contrib/deformable_convolution.cc | 2 +- src/operator/contrib/deformable_psroi_pooling.cc | 2 +- src/operator/contrib/deformable_psroi_pooling.cu | 2 +- src/operator/contrib/fft.cc | 2 +- src/operator/contrib/ifft.cc | 2 +- src/operator/contrib/multibox_detection.cc | 2 +- src/operator/contrib/multibox_prior.cc | 2 +- src/operator/contrib/multibox_target.cc | 2 +- src/operator/contrib/psroi_pooling.cc | 2 +- src/operator/contrib/psroi_pooling.cu | 2 +- src/operator/convolution_v1.cc | 2 +- src/operator/correlation.cc | 2 +- src/operator/correlation.cu | 2 +- src/operator/custom/custom.cc | 4 ++-- src/operator/grid_generator.cc | 2 +- src/operator/l2_normalization.cc | 2 +- src/operator/l2_normalization.cu | 2 +- src/operator/leaky_relu.cc | 2 +- src/operator/leaky_relu.cu | 2 +- src/operator/make_loss.cc | 2 +- src/operator/pad.cc | 2 +- src/operator/pooling_v1.cc | 4 ++-- src/operator/rnn.cc | 2 +- src/operator/roi_pooling.cc | 2 +- src/operator/roi_pooling.cu | 2 +- src/operator/sequence_last.cc | 2 +- src/operator/sequence_mask.cc | 2 +- src/operator/sequence_reverse.cc | 2 +- src/operator/sequence_reverse.cu | 2 +- src/operator/softmax_output.cc | 2 +- src/operator/spatial_transformer.cc | 2 +- src/operator/svm_output.cc | 2 +- src/operator/swapaxis.cc | 2 +- 42 files changed, 48 insertions(+), 48 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index c84ba323b604..af99026e5d70 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -54,7 +54,7 @@ Checks: > # In order to trigger an error, you must have a rule defined both in checks and in this section. WarningsAsErrors: > - cppcoreguidelines-no-malloc, performance-unnecessary-copy-initialization + cppcoreguidelines-no-malloc, modernize-use-nullptr, performance-unnecessary-copy-initialization # Todo: define a better regex match that includes most project headers, but excludes third party # code. diff --git a/src/c_api/c_api_executor.cc b/src/c_api/c_api_executor.cc index b99350525bfa..c3a64736c010 100644 --- a/src/c_api/c_api_executor.cc +++ b/src/c_api/c_api_executor.cc @@ -130,7 +130,7 @@ int MXExecutorBindX(SymbolHandle symbol_handle, num_map_keys, map_keys, map_dev_types, map_dev_ids, len, in_args, arg_grad_store, grad_req_type, aux_states_len, aux_states, - NULL, out); + nullptr, out); } int MXExecutorBindEX(SymbolHandle symbol_handle, diff --git a/src/io/iter_image_det_recordio.cc b/src/io/iter_image_det_recordio.cc index b93370026616..62e362c17277 100644 --- a/src/io/iter_image_det_recordio.cc +++ b/src/io/iter_image_det_recordio.cc @@ -303,7 +303,7 @@ inline void ImageDetRecordIOParser::Init( dmlc::InputSplit::Blob blob; while (reader.NextRecord(&blob)) { rec.Load(blob.dptr, blob.size); - if (rec.label != NULL) { + if (rec.label != nullptr) { if (param_.label_width > 0) { CHECK_EQ(param_.label_width, rec.num_label) << "rec file provide " << rec.num_label << "-dimensional label " @@ -416,7 +416,7 @@ ParseNext(std::vector> *out_vec) { std::vector label_buf; if (this->label_map_ != nullptr) { label_buf = label_map_->FindCopy(rec.image_index()); - } else if (rec.label != NULL) { + } else if (rec.label != nullptr) { if (param_.label_width > 0) { CHECK_EQ(param_.label_width, rec.num_label) << "rec file provide " << rec.num_label << "-dimensional label " diff --git a/src/io/iter_image_recordio.cc b/src/io/iter_image_recordio.cc index e8dcbef2e909..066cad973774 100644 --- a/src/io/iter_image_recordio.cc +++ b/src/io/iter_image_recordio.cc @@ -226,7 +226,7 @@ ParseNext(std::vector> *out_vec) { mshadow::Tensor label = out.label().Back(); if (label_map_ != nullptr) { mshadow::Copy(label, label_map_->Find(rec.image_index())); - } else if (rec.label != NULL) { + } else if (rec.label != nullptr) { CHECK_EQ(param_.label_width, rec.num_label) << "rec file provide " << rec.num_label << "-dimensional label " "but label_width is set to " << param_.label_width; diff --git a/src/io/iter_image_recordio_2.cc b/src/io/iter_image_recordio_2.cc index b6ff6e99b034..846d1abccbb5 100644 --- a/src/io/iter_image_recordio_2.cc +++ b/src/io/iter_image_recordio_2.cc @@ -303,7 +303,7 @@ inline bool ImageRecordIOParser2::ParseNext(DataBatch *out) { if (!legacy_shuffle_) { n_to_out = ParseChunk(data_dptr, label_dptr, current_size, &chunk); } else { - n_to_out = ParseChunk(NULL, NULL, batch_param_.batch_size, &chunk); + n_to_out = ParseChunk(nullptr, nullptr, batch_param_.batch_size, &chunk); } // Count number of parsed images that do not fit into current out n_parsed_ = inst_order_.size(); @@ -542,7 +542,7 @@ inline unsigned ImageRecordIOParser2::ParseChunk(DType* data_dptr, real_t std::vector label_buf; if (label_map_ != nullptr) { label_buf = label_map_->FindCopy(rec.image_index()); - } else if (rec.label != NULL) { + } else if (rec.label != nullptr) { CHECK_EQ(param_.label_width, rec.num_label) << "rec file provide " << rec.num_label << "-dimensional label " "but label_width is set to " << param_.label_width; @@ -624,7 +624,7 @@ inline void ImageRecordIOParser2::CreateMeanImg(void) { while (source_->NextChunk(&chunk)) { inst_order_.clear(); // Parse chunk w/o putting anything in out - ParseChunk(NULL, NULL, batch_param_.batch_size, &chunk); + ParseChunk(nullptr, nullptr, batch_param_.batch_size, &chunk); for (unsigned i = 0; i < inst_order_.size(); ++i) { std::pair place = inst_order_[i]; mshadow::Tensor outimg = diff --git a/src/io/iter_mnist.cc b/src/io/iter_mnist.cc index 1882a560d55f..40223472c96c 100644 --- a/src/io/iter_mnist.cc +++ b/src/io/iter_mnist.cc @@ -80,11 +80,11 @@ struct MNISTParam : public dmlc::Parameter { class MNISTIter: public IIterator { public: MNISTIter(void) : loc_(0), inst_offset_(0) { - img_.dptr_ = NULL; + img_.dptr_ = nullptr; out_.data.resize(2); } virtual ~MNISTIter(void) { - if (img_.dptr_ != NULL) delete []img_.dptr_; + if (img_.dptr_ != nullptr) delete []img_.dptr_; } // intialize iterator loads data in virtual void Init(const std::vector >& kwargs) { diff --git a/src/ndarray/ndarray.cc b/src/ndarray/ndarray.cc index ddffa28cfd31..b443d5d318cf 100644 --- a/src/ndarray/ndarray.cc +++ b/src/ndarray/ndarray.cc @@ -2046,7 +2046,7 @@ void Imdecode(NDArray *ret, NDArray mean, size_t index, #if MXNET_USE_OPENCV cv::Mat buf(1, size, CV_8U, str_img); cv::Mat res = cv::imdecode(buf, n_channels == 1 ? 0 : -1); - CHECK(res.data != NULL) << "OpenCV Failed to decode image"; + CHECK(res.data != nullptr) << "OpenCV Failed to decode image"; CHECK_LE(n_channels, static_cast(res.channels())); if (y1 - y0 == 0) { x0 = 0; diff --git a/src/operator/bilinear_sampler.cc b/src/operator/bilinear_sampler.cc index a3b7d5764245..c435fdeca481 100644 --- a/src/operator/bilinear_sampler.cc +++ b/src/operator/bilinear_sampler.cc @@ -163,7 +163,7 @@ namespace mxnet { namespace op { template<> Operator* CreateOp(BilinearSamplerParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new BilinearSamplerOp(param); }) diff --git a/src/operator/contrib/count_sketch.cc b/src/operator/contrib/count_sketch.cc index 12814116bbf4..ca239b63246f 100644 --- a/src/operator/contrib/count_sketch.cc +++ b/src/operator/contrib/count_sketch.cc @@ -30,7 +30,7 @@ namespace op { template<> Operator *CreateOp(CountSketchParam param, int dtype) { LOG(FATAL) << "CountSketch is only available for GPU."; - return NULL; + return nullptr; } Operator *CountSketchProp::CreateOperatorEx(Context ctx, std::vector *in_shape, std::vector *in_type) const { diff --git a/src/operator/contrib/deformable_convolution.cc b/src/operator/contrib/deformable_convolution.cc index 352baa12fbc1..78a7a1250d3c 100644 --- a/src/operator/contrib/deformable_convolution.cc +++ b/src/operator/contrib/deformable_convolution.cc @@ -36,7 +36,7 @@ Operator* CreateOp(DeformableConvolutionParam param, int dtype, std::vector *in_shape, std::vector *out_shape, Context ctx) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new DeformableConvolutionOp(param); }) diff --git a/src/operator/contrib/deformable_psroi_pooling.cc b/src/operator/contrib/deformable_psroi_pooling.cc index 42cf6f19df30..6aaf607f059a 100644 --- a/src/operator/contrib/deformable_psroi_pooling.cc +++ b/src/operator/contrib/deformable_psroi_pooling.cc @@ -81,7 +81,7 @@ namespace op { template<> Operator *CreateOp(DeformablePSROIPoolingParam param, int dtype) { - Operator* op = NULL; + Operator* op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new DeformablePSROIPoolingOp(param); }); diff --git a/src/operator/contrib/deformable_psroi_pooling.cu b/src/operator/contrib/deformable_psroi_pooling.cu index 71bbd4cd7f2a..bf7d1c0bc755 100644 --- a/src/operator/contrib/deformable_psroi_pooling.cu +++ b/src/operator/contrib/deformable_psroi_pooling.cu @@ -423,7 +423,7 @@ namespace op { template<> Operator* CreateOp(DeformablePSROIPoolingParam param, int dtype) { - Operator* op = NULL; + Operator* op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new DeformablePSROIPoolingOp(param); }); diff --git a/src/operator/contrib/fft.cc b/src/operator/contrib/fft.cc index 8332451bf921..4a4395836e3f 100644 --- a/src/operator/contrib/fft.cc +++ b/src/operator/contrib/fft.cc @@ -30,7 +30,7 @@ namespace op { template<> Operator *CreateOp(FFTParam param, int dtype) { LOG(FATAL) << "fft is only available for GPU."; - return NULL; + return nullptr; } Operator *FFTProp::CreateOperatorEx(Context ctx, std::vector *in_shape, diff --git a/src/operator/contrib/ifft.cc b/src/operator/contrib/ifft.cc index 26e7041ce02f..cb4605d8b787 100644 --- a/src/operator/contrib/ifft.cc +++ b/src/operator/contrib/ifft.cc @@ -31,7 +31,7 @@ namespace op { template<> Operator *CreateOp(IFFTParam param, int dtype) { LOG(FATAL) << "ifft is only available for GPU."; - return NULL; + return nullptr; } Operator *IFFTProp::CreateOperatorEx(Context ctx, std::vector *in_shape, diff --git a/src/operator/contrib/multibox_detection.cc b/src/operator/contrib/multibox_detection.cc index f92460e9e5e9..c005dfa06590 100644 --- a/src/operator/contrib/multibox_detection.cc +++ b/src/operator/contrib/multibox_detection.cc @@ -198,7 +198,7 @@ namespace mxnet { namespace op { template<> Operator *CreateOp(MultiBoxDetectionParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new MultiBoxDetectionOp(param); }); diff --git a/src/operator/contrib/multibox_prior.cc b/src/operator/contrib/multibox_prior.cc index 22a9c10cd958..579ea608aa9f 100644 --- a/src/operator/contrib/multibox_prior.cc +++ b/src/operator/contrib/multibox_prior.cc @@ -76,7 +76,7 @@ namespace mxnet { namespace op { template<> Operator* CreateOp(MultiBoxPriorParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new MultiBoxPriorOp(param); }); diff --git a/src/operator/contrib/multibox_target.cc b/src/operator/contrib/multibox_target.cc index 2fa041dd34cf..093234b59ec3 100644 --- a/src/operator/contrib/multibox_target.cc +++ b/src/operator/contrib/multibox_target.cc @@ -284,7 +284,7 @@ namespace mxnet { namespace op { template<> Operator *CreateOp(MultiBoxTargetParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new MultiBoxTargetOp(param); }); diff --git a/src/operator/contrib/psroi_pooling.cc b/src/operator/contrib/psroi_pooling.cc index 75b533446b8e..d3a3871ed004 100644 --- a/src/operator/contrib/psroi_pooling.cc +++ b/src/operator/contrib/psroi_pooling.cc @@ -66,7 +66,7 @@ namespace op { template<> Operator *CreateOp(PSROIPoolingParam param, int dtype) { - Operator* op = NULL; + Operator* op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new PSROIPoolingOp(param); }); diff --git a/src/operator/contrib/psroi_pooling.cu b/src/operator/contrib/psroi_pooling.cu index 472131637461..e4de9248dfbf 100644 --- a/src/operator/contrib/psroi_pooling.cu +++ b/src/operator/contrib/psroi_pooling.cu @@ -268,7 +268,7 @@ namespace op { template<> Operator* CreateOp(PSROIPoolingParam param, int dtype) { - Operator* op = NULL; + Operator* op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new PSROIPoolingOp(param); }); diff --git a/src/operator/convolution_v1.cc b/src/operator/convolution_v1.cc index 86c0fbb33291..b6250a7a77f5 100644 --- a/src/operator/convolution_v1.cc +++ b/src/operator/convolution_v1.cc @@ -38,7 +38,7 @@ Operator* CreateOp(ConvolutionV1Param param, int dtype, std::vector *in_shape, std::vector *out_shape, Context ctx) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new ConvolutionV1Op(param); }) diff --git a/src/operator/correlation.cc b/src/operator/correlation.cc index fe89e8462d12..d0c664ad4f9c 100644 --- a/src/operator/correlation.cc +++ b/src/operator/correlation.cc @@ -149,7 +149,7 @@ namespace mxnet { namespace op { template<> Operator *CreateOp(CorrelationParam param, int dtype) { - Operator* op = NULL; + Operator* op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new CorrelationOp(param); }); diff --git a/src/operator/correlation.cu b/src/operator/correlation.cu index 6bc16cde5098..821b9007a8fe 100644 --- a/src/operator/correlation.cu +++ b/src/operator/correlation.cu @@ -622,7 +622,7 @@ namespace mxnet { namespace op { template<> Operator* CreateOp(CorrelationParam param, int dtype) { - Operator* op = NULL; + Operator* op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new CorrelationOp(param); }); diff --git a/src/operator/custom/custom.cc b/src/operator/custom/custom.cc index d117a2842166..4cda1375fd29 100644 --- a/src/operator/custom/custom.cc +++ b/src/operator/custom/custom.cc @@ -75,12 +75,12 @@ inline void AllocateNDArrayCopy(NDArray** nd, template std::vector List(const NodeAttrs& attrs) { const CustomParam& params = nnvm::get(attrs.parsed); - char ** args = NULL; + char ** args = nullptr; CHECK(reinterpret_cast( params.info->callbacks[Type])( &args, params.info->contexts[Type])); std::vector ret; - for (int i = 0; args[i] != NULL; ++i) { + for (int i = 0; args[i] != nullptr; ++i) { ret.push_back(args[i]); } return ret; diff --git a/src/operator/grid_generator.cc b/src/operator/grid_generator.cc index ea6e66145c4a..96ec5d5a7e7a 100644 --- a/src/operator/grid_generator.cc +++ b/src/operator/grid_generator.cc @@ -30,7 +30,7 @@ namespace mxnet { namespace op { template<> Operator* CreateOp(GridGeneratorParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; if (dtype == mshadow::kFloat32) { op = new GridGeneratorOp(param); } else { diff --git a/src/operator/l2_normalization.cc b/src/operator/l2_normalization.cc index c313b4424423..f2f485ae6d1b 100644 --- a/src/operator/l2_normalization.cc +++ b/src/operator/l2_normalization.cc @@ -27,7 +27,7 @@ namespace mxnet { namespace op { template<> Operator* CreateOp(L2NormalizationParam param, int dtype) { - Operator* op = NULL; + Operator* op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new L2NormalizationOp(param); }); diff --git a/src/operator/l2_normalization.cu b/src/operator/l2_normalization.cu index 2034f984174d..e5157811d894 100644 --- a/src/operator/l2_normalization.cu +++ b/src/operator/l2_normalization.cu @@ -27,7 +27,7 @@ namespace mxnet { namespace op { template<> Operator* CreateOp(L2NormalizationParam param, int dtype) { - Operator* op = NULL; + Operator* op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new L2NormalizationOp(param); }); diff --git a/src/operator/leaky_relu.cc b/src/operator/leaky_relu.cc index 4bb24237b8ed..45f9511c9085 100644 --- a/src/operator/leaky_relu.cc +++ b/src/operator/leaky_relu.cc @@ -31,7 +31,7 @@ namespace mxnet { namespace op { template<> Operator *CreateOp(LeakyReLUParam param, int dtype) { - Operator* op = NULL; + Operator* op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new LeakyReLUOp(param); }); diff --git a/src/operator/leaky_relu.cu b/src/operator/leaky_relu.cu index 74b444d87597..a2e0e959a15b 100644 --- a/src/operator/leaky_relu.cu +++ b/src/operator/leaky_relu.cu @@ -30,7 +30,7 @@ namespace mxnet { namespace op { template<> Operator *CreateOp(LeakyReLUParam param, int dtype) { - Operator* op = NULL; + Operator* op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new LeakyReLUOp(param); }); diff --git a/src/operator/make_loss.cc b/src/operator/make_loss.cc index 14304d3cc263..7e45f4ce4ff4 100644 --- a/src/operator/make_loss.cc +++ b/src/operator/make_loss.cc @@ -28,7 +28,7 @@ namespace mxnet { namespace op { template<> Operator *CreateOp(MakeLossParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new MakeLossOp(param); }); diff --git a/src/operator/pad.cc b/src/operator/pad.cc index 2332c93b8d5b..6c66b29082c4 100644 --- a/src/operator/pad.cc +++ b/src/operator/pad.cc @@ -668,7 +668,7 @@ namespace mxnet { namespace op { template <> Operator *CreateOp(PadParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new PadOp(param); }) return op; } diff --git a/src/operator/pooling_v1.cc b/src/operator/pooling_v1.cc index 5b68a08db602..afb51d762ddd 100644 --- a/src/operator/pooling_v1.cc +++ b/src/operator/pooling_v1.cc @@ -30,7 +30,7 @@ namespace op { template<> Operator *CreateOp(PoolingV1Param param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { switch (param.pool_type) { case pool_v1_enum::kMaxPooling: @@ -44,7 +44,7 @@ Operator *CreateOp(PoolingV1Param param, int dtype) { break; default: LOG(FATAL) << "unknown pooling type"; - return NULL; + return nullptr; } }) diff --git a/src/operator/rnn.cc b/src/operator/rnn.cc index 73ef4f0f42a7..9ba764904e15 100644 --- a/src/operator/rnn.cc +++ b/src/operator/rnn.cc @@ -29,7 +29,7 @@ namespace mxnet { namespace op { template<> Operator *CreateOp(RNNParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new RNNOp(param); }); diff --git a/src/operator/roi_pooling.cc b/src/operator/roi_pooling.cc index 124d811c46a0..7f15dcb406dc 100644 --- a/src/operator/roi_pooling.cc +++ b/src/operator/roi_pooling.cc @@ -234,7 +234,7 @@ namespace op { template<> Operator *CreateOp(ROIPoolingParam param, int dtype) { - Operator* op = NULL; + Operator* op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new ROIPoolingOp(param); }); diff --git a/src/operator/roi_pooling.cu b/src/operator/roi_pooling.cu index 066c2ffd0635..9ea99b309aaf 100644 --- a/src/operator/roi_pooling.cu +++ b/src/operator/roi_pooling.cu @@ -264,7 +264,7 @@ namespace op { template<> Operator* CreateOp(ROIPoolingParam param, int dtype) { - Operator* op = NULL; + Operator* op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new ROIPoolingOp(param); }); diff --git a/src/operator/sequence_last.cc b/src/operator/sequence_last.cc index f87400b21f94..345524b38134 100644 --- a/src/operator/sequence_last.cc +++ b/src/operator/sequence_last.cc @@ -29,7 +29,7 @@ namespace mxnet { namespace op { template <> Operator *CreateOp(SequenceLastParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_TYPE_SWITCH(dtype, DType, { op = new SequenceLastOp(param); }) return op; diff --git a/src/operator/sequence_mask.cc b/src/operator/sequence_mask.cc index 047634cc7bcd..e02c57bfd917 100644 --- a/src/operator/sequence_mask.cc +++ b/src/operator/sequence_mask.cc @@ -29,7 +29,7 @@ namespace mxnet { namespace op { template <> Operator *CreateOp(SequenceMaskParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_TYPE_SWITCH(dtype, DType, { op = new SequenceMaskOp(param); }) return op; diff --git a/src/operator/sequence_reverse.cc b/src/operator/sequence_reverse.cc index 834e4f401ede..21cab7891101 100644 --- a/src/operator/sequence_reverse.cc +++ b/src/operator/sequence_reverse.cc @@ -29,7 +29,7 @@ namespace mxnet { namespace op { template <> Operator *CreateOp(SequenceReverseParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_TYPE_SWITCH(dtype, DType, { op = new SequenceReverseOp(param); }) return op; diff --git a/src/operator/sequence_reverse.cu b/src/operator/sequence_reverse.cu index 9c1574814a16..1edc9c13d493 100644 --- a/src/operator/sequence_reverse.cu +++ b/src/operator/sequence_reverse.cu @@ -29,7 +29,7 @@ namespace mxnet { namespace op { template <> Operator *CreateOp(SequenceReverseParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_TYPE_SWITCH(dtype, DType, { op = new SequenceReverseOp(param); }) diff --git a/src/operator/softmax_output.cc b/src/operator/softmax_output.cc index 27b3295654b9..5ba421fd195b 100644 --- a/src/operator/softmax_output.cc +++ b/src/operator/softmax_output.cc @@ -29,7 +29,7 @@ namespace mxnet { namespace op { template<> Operator *CreateOp(SoftmaxOutputParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new SoftmaxOutputOp(param); }) diff --git a/src/operator/spatial_transformer.cc b/src/operator/spatial_transformer.cc index 8c6779df1b7a..2dcb427ef036 100644 --- a/src/operator/spatial_transformer.cc +++ b/src/operator/spatial_transformer.cc @@ -153,7 +153,7 @@ namespace mxnet { namespace op { template<> Operator* CreateOp(SpatialTransformerParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new SpatialTransformerOp(param); }) diff --git a/src/operator/svm_output.cc b/src/operator/svm_output.cc index c84c2af28483..a291f7298706 100644 --- a/src/operator/svm_output.cc +++ b/src/operator/svm_output.cc @@ -71,7 +71,7 @@ namespace mxnet { namespace op { template<> Operator *CreateOp(SVMOutputParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_REAL_TYPE_SWITCH(dtype, DType, { op = new SVMOutputOp(param); }) diff --git a/src/operator/swapaxis.cc b/src/operator/swapaxis.cc index 12bc52e1f6fd..b78062fde8be 100644 --- a/src/operator/swapaxis.cc +++ b/src/operator/swapaxis.cc @@ -31,7 +31,7 @@ namespace op { template<> Operator* CreateOp(SwapAxisParam param, int dtype) { - Operator *op = NULL; + Operator *op = nullptr; MSHADOW_TYPE_SWITCH(dtype, DType, { op = new SwapAxisOp(param); });