From 84ded49d6632aec9733bbbcd242c539029711cd8 Mon Sep 17 00:00:00 2001 From: xzl Date: Thu, 1 Feb 2018 23:46:43 +0800 Subject: [PATCH] fix comments --- paddle/operators/conv_op.h | 3 +++ paddle/operators/math/depthwise_conv.cu | 11 +++++++---- paddle/operators/math/depthwise_conv.h | 11 +++++++---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/paddle/operators/conv_op.h b/paddle/operators/conv_op.h index 5b47eefb83..3c1d0e9c1c 100644 --- a/paddle/operators/conv_op.h +++ b/paddle/operators/conv_op.h @@ -361,6 +361,9 @@ class DepthwiseConvKernel : public framework::OpKernel { Tensor* output = context.Output("Output"); output->mutable_data(context.GetPlace()); + PADDLE_ENFORCE_EQ( + output->dims()[1] % input->dims()[1], 0, + "The output channels must be a multiple of the input channels"); std::vector strides = context.Attr>("strides"); std::vector paddings = context.Attr>("paddings"); std::vector dilations = context.Attr>("dilations"); diff --git a/paddle/operators/math/depthwise_conv.cu b/paddle/operators/math/depthwise_conv.cu index 4aa38151e6..b9b958c92b 100644 --- a/paddle/operators/math/depthwise_conv.cu +++ b/paddle/operators/math/depthwise_conv.cu @@ -203,8 +203,9 @@ class DepthwiseConvFunctor { public: void operator()(const platform::CUDADeviceContext& context, const framework::Tensor& input, - const framework::Tensor& filter, std::vector& strides, - std::vector& paddings, framework::Tensor* output) { + const framework::Tensor& filter, + const std::vector& strides, + const std::vector& paddings, framework::Tensor* output) { const int batch_size = input.dims()[0]; const int input_channels = input.dims()[1]; const int input_height = input.dims()[2]; @@ -244,7 +245,8 @@ class DepthwiseConvInputGradFunctor { const framework::Tensor& input, const framework::Tensor& filter, const framework::Tensor& output_grad, - std::vector& strides, std::vector& paddings, + const std::vector& strides, + const std::vector& paddings, framework::Tensor* input_grad) { const int batch_size = input.dims()[0]; const int input_channels = input.dims()[1]; @@ -284,7 +286,8 @@ class DepthwiseConvFilterGradFunctor { void operator()(const platform::CUDADeviceContext& context, const framework::Tensor& input, const framework::Tensor& output_grad, - std::vector& strides, std::vector& paddings, + const std::vector& strides, + const std::vector& paddings, framework::Tensor* filter_grad) { const int batch_size = input.dims()[0]; const int input_channels = input.dims()[1]; diff --git a/paddle/operators/math/depthwise_conv.h b/paddle/operators/math/depthwise_conv.h index 34eecca7b6..4708920bb4 100644 --- a/paddle/operators/math/depthwise_conv.h +++ b/paddle/operators/math/depthwise_conv.h @@ -29,8 +29,9 @@ template class DepthwiseConvFunctor { public: void operator()(const DeviceContext& context, const framework::Tensor& input, - const framework::Tensor& filter, std::vector& strides, - std::vector& paddings, framework::Tensor* output); + const framework::Tensor& filter, + const std::vector& strides, + const std::vector& paddings, framework::Tensor* output); }; template @@ -39,7 +40,8 @@ class DepthwiseConvInputGradFunctor { void operator()(const DeviceContext& context, const framework::Tensor& input, const framework::Tensor& filter, const framework::Tensor& output_grad, - std::vector& strides, std::vector& paddings, + const std::vector& strides, + const std::vector& paddings, framework::Tensor* input_grad); }; @@ -48,7 +50,8 @@ class DepthwiseConvFilterGradFunctor { public: void operator()(const DeviceContext& context, const framework::Tensor& input, const framework::Tensor& output_grad, - std::vector& strides, std::vector& paddings, + const std::vector& strides, + const std::vector& paddings, framework::Tensor* filter_grad); }; -- GitLab