diff --git a/paddle/fluid/inference/api/helper.h b/paddle/fluid/inference/api/helper.h index 92b6f12338f79742a42df3c04290a5c443243c70..d379930517dac18c80785bb6afb0e1087a9c24f0 100644 --- a/paddle/fluid/inference/api/helper.h +++ b/paddle/fluid/inference/api/helper.h @@ -339,7 +339,7 @@ static bool CompareTensor(const PaddleTensor &a, const PaddleTensor &b) { } static std::string DescribeTensor(const PaddleTensor &tensor, - int max_num_of_data = 15) { + int max_num_of_data UNUSED = 15) { std::stringstream os; os << "Tensor [" << tensor.name << "]\n"; os << " - type: "; diff --git a/paddle/fluid/operators/assign_op.h b/paddle/fluid/operators/assign_op.h index f45d00ba82c77dac3a71b4a7a7b521b560a5d552..6efc6211209292abf69f3392d78bd883785d5ac0 100644 --- a/paddle/fluid/operators/assign_op.h +++ b/paddle/fluid/operators/assign_op.h @@ -60,7 +60,7 @@ class AssignFunctor { } template - void operator()(const T &v) const { + void operator()(const T &v UNUSED) const { PADDLE_ENFORCE_EQ( true, false, diff --git a/paddle/phi/core/kernel_registry.h b/paddle/phi/core/kernel_registry.h index 3ca455da1dd40790508e3bc994b7f91911cafb94..f4e021f7269a797571c445f57ddebe01551c679c 100644 --- a/paddle/phi/core/kernel_registry.h +++ b/paddle/phi/core/kernel_registry.h @@ -1433,16 +1433,16 @@ struct KernelRegistrar { reg_type, kernel_name, layout, meta_kernel_fn, N, ...) \ static void __PD_KERNEL_args_def_FN_##kernel_name##_##layout( \ const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel); \ - PD_EXPAND( \ - PD_CONCATENATE(_PD_FOR_ALL_BACKEND_DTYPE_, N)( \ - reg_type, \ - kernel_name, \ - layout, \ - meta_kernel_fn, \ - __PD_KERNEL_args_def_FN_##kernel_name##_##layout, \ - __VA_ARGS__) void \ - __PD_KERNEL_args_def_FN_##kernel_name##_##layout( \ - const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel)) + PD_EXPAND(PD_CONCATENATE(_PD_FOR_ALL_BACKEND_DTYPE_, N)( \ + reg_type, \ + kernel_name, \ + layout, \ + meta_kernel_fn, \ + __PD_KERNEL_args_def_FN_##kernel_name##_##layout, \ + __VA_ARGS__) void \ + __PD_KERNEL_args_def_FN_##kernel_name##_##layout( \ + const ::phi::KernelKey& kernel_key UNUSED, \ + ::phi::Kernel* kernel UNUSED)) #ifndef _WIN32 #define ___PD_REGISTER_KERNEL_FOR_ALL_BACKEND_DTYPE( \ reg_type, kernel_name, backend, layout, kernel_fn, args_def_fn) \ diff --git a/paddle/phi/kernels/check_memory_continue_kernel.cc b/paddle/phi/kernels/check_memory_continue_kernel.cc index 819bb30712bf05b26bc2bc26734890989157cc38..6e496a355302fc9552bf9d576217c4c2ff83148d 100644 --- a/paddle/phi/kernels/check_memory_continue_kernel.cc +++ b/paddle/phi/kernels/check_memory_continue_kernel.cc @@ -28,7 +28,7 @@ template void CheckMemoryContinueKernel(const Context &dev_ctx, const std::vector &input, DenseTensor *output, - std::vector xout) { + std::vector xout UNUSED) { int64_t size_of_dtype = sizeof(T); auto dtype = input.at(0)->dtype(); int64_t numel = 0; diff --git a/paddle/phi/kernels/cpu/cum_kernel.cc b/paddle/phi/kernels/cpu/cum_kernel.cc index f7ec5bbbf9e844fc51538641e180018c32b9e438..ec6c3cfd0baab18f25561086b262522b18d94584 100644 --- a/paddle/phi/kernels/cpu/cum_kernel.cc +++ b/paddle/phi/kernels/cpu/cum_kernel.cc @@ -52,7 +52,7 @@ template void ScanKernel(const Context& dev_ctx, const DenseTensor& x, int axis, - bool flatten, + bool flatten UNUSED, bool exclusive, bool reverse, Reducer reducer, diff --git a/paddle/phi/kernels/cpu/diagonal_grad_kernel.cc b/paddle/phi/kernels/cpu/diagonal_grad_kernel.cc index f5d6ee2dce6749d6132ecef15cd461b564eb8add..151ec3df10356655ac241d7ce27f06216b73585d 100644 --- a/paddle/phi/kernels/cpu/diagonal_grad_kernel.cc +++ b/paddle/phi/kernels/cpu/diagonal_grad_kernel.cc @@ -22,7 +22,7 @@ namespace phi { template void DiagonalGradKernel(const Context& dev_ctx, - const DenseTensor& x, + const DenseTensor& x UNUSED, const DenseTensor& out_grad, int offset, int axis1, diff --git a/paddle/phi/kernels/cpu/elementwise_grad.h b/paddle/phi/kernels/cpu/elementwise_grad.h index 05c02f167b6a2db6674152b7a1a110e19ca4e247..0602d529de842a5af3b9b31aa187de533be0bd5d 100644 --- a/paddle/phi/kernels/cpu/elementwise_grad.h +++ b/paddle/phi/kernels/cpu/elementwise_grad.h @@ -75,7 +75,9 @@ void ElemwiseExplicitGradCompute(const CPUContext& dev_ctx, */ template struct IdentityGrad { - HOSTDEVICE T operator()(T x, T y, T out, T dout) const { return dout; } + HOSTDEVICE T operator()(T x UNUSED, T y UNUSED, T out UNUSED, T dout) const { + return dout; + } }; template @@ -120,12 +122,16 @@ ElementwiseAddGrad(const CPUContext& ctx, template struct SubGradDX { - HOSTDEVICE T operator()(T x, T y, T out, T dout) const { return dout; } + HOSTDEVICE T operator()(T x UNUSED, T y UNUSED, T out UNUSED, T dout) const { + return dout; + } }; template struct SubGradDY { - HOSTDEVICE T operator()(T x, T y, T out, T dout) const { return -dout; } + HOSTDEVICE T operator()(T x UNUSED, T y UNUSED, T out UNUSED, T dout) const { + return -dout; + } }; template diff --git a/paddle/phi/kernels/cpu/gather_grad_kernel.cc b/paddle/phi/kernels/cpu/gather_grad_kernel.cc index 0d0341234e60b16c28c12167871bb8b12d683cd8..456c7ea633cde3583570d0570d841646522e590a 100644 --- a/paddle/phi/kernels/cpu/gather_grad_kernel.cc +++ b/paddle/phi/kernels/cpu/gather_grad_kernel.cc @@ -24,7 +24,7 @@ namespace phi { template void GatherGradKernel(const Context& dev_ctx, - const DenseTensor& x, + const DenseTensor& x UNUSED, const DenseTensor& index, const DenseTensor& out_grad, const Scalar& axis, diff --git a/paddle/phi/kernels/cpu/overlap_add_grad_kernel.cc b/paddle/phi/kernels/cpu/overlap_add_grad_kernel.cc index 4f6dd6e14829a86423f7f8cf75f2aa4f17a4734c..bee17b3d3b969a06c0375003f3e1000f24f17f80 100644 --- a/paddle/phi/kernels/cpu/overlap_add_grad_kernel.cc +++ b/paddle/phi/kernels/cpu/overlap_add_grad_kernel.cc @@ -21,7 +21,7 @@ namespace phi { template void OverlapAddGradKernel(const Context& dev_ctx, - const DenseTensor& x, + const DenseTensor& x UNUSED, const DenseTensor& out_grad, int hop_length, int axis, diff --git a/paddle/phi/kernels/cpu/pad3d_kernel.cc b/paddle/phi/kernels/cpu/pad3d_kernel.cc index aa44491a2a967d75ad412247aeaa8a64049c8e76..d26e2fc7ea98637f94800b5422256629c1694938 100644 --- a/paddle/phi/kernels/cpu/pad3d_kernel.cc +++ b/paddle/phi/kernels/cpu/pad3d_kernel.cc @@ -26,7 +26,7 @@ void ConstPad3DFuncNCDHW(const T* in_data, const int in_depth, const int in_height, const int in_width, - const int out_depth, + const int out_depth UNUSED, const int out_height, const int out_width, const int pad_front, @@ -53,7 +53,7 @@ void ConstPad3DFuncNDHWC(const T* in_data, const int in_depth, const int in_height, const int in_width, - const int out_depth, + const int out_depth UNUSED, const int out_height, const int out_width, const int pad_front, @@ -88,7 +88,7 @@ void ReflectPad3DFuncNCDHW(const T* in_data, const int in_depth, const int in_height, const int in_width, - const int out_depth, + const int out_depth UNUSED, const int out_height, const int out_width, const int pad_front, @@ -97,7 +97,7 @@ void ReflectPad3DFuncNCDHW(const T* in_data, const int out_d, const int out_h, const int out_w, - const T value) { + const T value UNUSED) { int in_d = out_d - pad_front; int in_h = out_h - pad_top; int in_w = out_w - pad_left; @@ -120,7 +120,7 @@ void ReflectPad3DFuncNDHWC(const T* in_data, const int in_depth, const int in_height, const int in_width, - const int out_depth, + const int out_depth UNUSED, const int out_height, const int out_width, const int pad_front, @@ -129,7 +129,7 @@ void ReflectPad3DFuncNDHWC(const T* in_data, const int out_d, const int out_h, const int out_w, - const T value) { + const T value UNUSED) { int in_d = out_d - pad_front; int in_h = out_h - pad_top; int in_w = out_w - pad_left; @@ -156,7 +156,7 @@ void ReplicatePad3DFuncNCDHW(const T* in_data, const int in_depth, const int in_height, const int in_width, - const int out_depth, + const int out_depth UNUSED, const int out_height, const int out_width, const int pad_front, @@ -165,7 +165,7 @@ void ReplicatePad3DFuncNCDHW(const T* in_data, const int out_d, const int out_h, const int out_w, - const T value) { + const T value UNUSED) { int in_d = std::min(in_depth - 1, std::max(out_d - pad_front, 0)); int in_h = std::min(in_height - 1, std::max(out_h - pad_top, 0)); int in_w = std::min(in_width - 1, std::max(out_w - pad_left, 0)); @@ -181,7 +181,7 @@ void ReplicatePad3DFuncNDHWC(const T* in_data, const int in_depth, const int in_height, const int in_width, - const int out_depth, + const int out_depth UNUSED, const int out_height, const int out_width, const int pad_front, @@ -190,7 +190,7 @@ void ReplicatePad3DFuncNDHWC(const T* in_data, const int out_d, const int out_h, const int out_w, - const T value) { + const T value UNUSED) { int in_d = std::min(in_depth - 1, std::max(out_d - pad_front, 0)); int in_h = std::min(in_height - 1, std::max(out_h - pad_top, 0)); int in_w = std::min(in_width - 1, std::max(out_w - pad_left, 0)); @@ -210,7 +210,7 @@ void CircularPad3DFuncNCDHW(const T* in_data, const int in_depth, const int in_height, const int in_width, - const int out_depth, + const int out_depth UNUSED, const int out_height, const int out_width, const int pad_front, @@ -219,7 +219,7 @@ void CircularPad3DFuncNCDHW(const T* in_data, const int out_d, const int out_h, const int out_w, - const T value) { + const T value UNUSED) { int in_d = ((out_d - pad_front) % in_depth + in_depth) % in_depth; int in_h = ((out_h - pad_top) % in_height + in_height) % in_height; int in_w = ((out_w - pad_left) % in_width + in_width) % in_width; @@ -235,7 +235,7 @@ void CircularPad3DFuncNDHWC(const T* in_data, const int in_depth, const int in_height, const int in_width, - const int out_depth, + const int out_depth UNUSED, const int out_height, const int out_width, const int pad_front, @@ -244,7 +244,7 @@ void CircularPad3DFuncNDHWC(const T* in_data, const int out_d, const int out_h, const int out_w, - const T value) { + const T value UNUSED) { int in_d = ((out_d - pad_front) % in_depth + in_depth) % in_depth; int in_h = ((out_h - pad_top) % in_height + in_height) % in_height; int in_w = ((out_w - pad_left) % in_width + in_width) % in_width; diff --git a/paddle/phi/kernels/cpu/roll_grad_kernel.cc b/paddle/phi/kernels/cpu/roll_grad_kernel.cc index c348bfe30045e26657cd45ed5d265d5ced9c6351..bee30ad8e49de67921710112c9bbf09d14bc304e 100644 --- a/paddle/phi/kernels/cpu/roll_grad_kernel.cc +++ b/paddle/phi/kernels/cpu/roll_grad_kernel.cc @@ -22,7 +22,7 @@ namespace phi { template void RollGradKernel(const Context& dev_ctx, - const DenseTensor& x, + const DenseTensor& x UNUSED, const DenseTensor& out_grad, const IntArray& shifts, const std::vector& axis, diff --git a/paddle/phi/kernels/funcs/activation_functor.h b/paddle/phi/kernels/funcs/activation_functor.h index ccc2c474499d778535a7efe22278987f0b953f6b..df63c22c9460023a0055aed61fad10df9d99a291 100644 --- a/paddle/phi/kernels/funcs/activation_functor.h +++ b/paddle/phi/kernels/funcs/activation_functor.h @@ -1112,7 +1112,7 @@ struct Expm1GradFunctor : public BaseActivationFunctor { typename Out, typename dOut, typename dX> - void operator()(Device d, X x, Out out, dOut dout, dX dx) const { + void operator()(Device d, X x UNUSED, Out out, dOut dout, dX dx) const { dx.device(d) = dout * out + dout; } @@ -1412,7 +1412,7 @@ struct LeakyReluGradFunctor : public BaseActivationFunctor { typename Out, typename dOut, typename dX> - void operator()(Device d, X x, Out out, dOut dout, dX dx) const { + void operator()(Device d, X x, Out out UNUSED, dOut dout, dX dx) const { auto temp1 = static_cast(alpha) * (x < static_cast(0)).template cast(); auto temp2 = (x >= static_cast(0)).template cast(); diff --git a/paddle/phi/kernels/funcs/selected_rows_functor.cc b/paddle/phi/kernels/funcs/selected_rows_functor.cc index efeb742cfd2ae2d69ea91c247f73fbaf81ca91f6..0c91d250d231384e4ba57f6028c5e96d88bf329d 100644 --- a/paddle/phi/kernels/funcs/selected_rows_functor.cc +++ b/paddle/phi/kernels/funcs/selected_rows_functor.cc @@ -288,7 +288,7 @@ template struct SelectedRowsSumTo; template struct SelectedRowsAddToTensor { - void operator()(const phi::CPUContext& context, + void operator()(const phi::CPUContext& context UNUSED, const phi::SelectedRows& input1, phi::DenseTensor* input2) { if (UNLIKELY(input1.rows().size() == 0)) { diff --git a/paddle/phi/kernels/funcs/squared_l2_norm.h b/paddle/phi/kernels/funcs/squared_l2_norm.h index ccb208791b849130d7a8c222efcb24b6d0c0a217..c77552822bbfb7d4406271d68f0457aa604d925d 100644 --- a/paddle/phi/kernels/funcs/squared_l2_norm.h +++ b/paddle/phi/kernels/funcs/squared_l2_norm.h @@ -36,7 +36,7 @@ void SquaredL2Norm(const phi::CPUContext& ctx, const T1* x, T2* y, size_t numel, - memory_utils::Buffer* buffer = nullptr) { + memory_utils::Buffer* buffer UNUSED = nullptr) { if (std::is_same::value) { using EigenT = typename phi::EigenTensor::Type; using ConstEigenT = typename phi::EigenTensor::ConstType; diff --git a/paddle/phi/kernels/impl/fill_grad_kernel_impl.h b/paddle/phi/kernels/impl/fill_grad_kernel_impl.h index dffb81fbea4e3614306e28081255ae7f23daec04..a8a67a2b080c6da1ce651bcdc2d9b5d6c869d816 100644 --- a/paddle/phi/kernels/impl/fill_grad_kernel_impl.h +++ b/paddle/phi/kernels/impl/fill_grad_kernel_impl.h @@ -24,8 +24,8 @@ namespace phi { template void FillGradKernel(const Context& dev_ctx, - const DenseTensor& out_grad, - const Scalar& value, + const DenseTensor& out_grad UNUSED, + const Scalar& value UNUSED, DenseTensor* in_grad) { if (in_grad) { dev_ctx.template Alloc(in_grad); diff --git a/paddle/phi/kernels/impl/frame_grad_kernel_impl.h b/paddle/phi/kernels/impl/frame_grad_kernel_impl.h index 9d1bfe453d09aa9c95fe7228ad7ccc0b6c6eb713..9f6ceee24f183ac73cfbdd98dd28b1d74c3b5279 100644 --- a/paddle/phi/kernels/impl/frame_grad_kernel_impl.h +++ b/paddle/phi/kernels/impl/frame_grad_kernel_impl.h @@ -20,7 +20,7 @@ namespace phi { template void FrameGradKernel(const Context& dev_ctx, - const DenseTensor& x, + const DenseTensor& x UNUSED, const DenseTensor& dout, int frame_length, int hop_length, diff --git a/paddle/phi/kernels/impl/pad_grad_kernel_impl.h b/paddle/phi/kernels/impl/pad_grad_kernel_impl.h index 4939a41c25a69757647bd4f991fcd49063d5cf76..875045f8c8e8f08187f3de32496196ca56fb25c5 100644 --- a/paddle/phi/kernels/impl/pad_grad_kernel_impl.h +++ b/paddle/phi/kernels/impl/pad_grad_kernel_impl.h @@ -22,7 +22,7 @@ template void PadGradKernel(const Context& dev_ctx, const DenseTensor& d_out, const std::vector& paddings, - const Scalar& pad_value, + const Scalar& pad_value UNUSED, DenseTensor* d_x) { if (d_x == nullptr) { return; diff --git a/paddle/phi/kernels/impl/trace_grad_kernel_impl.h b/paddle/phi/kernels/impl/trace_grad_kernel_impl.h index 1099f27f3622e6156d9765f4af9dd60947de8714..640fd07a92a2be1e1c690000ccaa0b0252c4d577 100644 --- a/paddle/phi/kernels/impl/trace_grad_kernel_impl.h +++ b/paddle/phi/kernels/impl/trace_grad_kernel_impl.h @@ -82,7 +82,7 @@ struct TraceGradFunctor { template void TraceGradKernel(const Context& ctx, - const DenseTensor& x, + const DenseTensor& x UNUSED, const DenseTensor& out_grad, int offset, int axis1, diff --git a/paddle/phi/kernels/sparse/sparse_utils_kernel.h b/paddle/phi/kernels/sparse/sparse_utils_kernel.h index e06391d9404ef9caaa17c3add67771cb427b8cb4..8d92b312bd857a1f9a68df53052646525b194789 100644 --- a/paddle/phi/kernels/sparse/sparse_utils_kernel.h +++ b/paddle/phi/kernels/sparse/sparse_utils_kernel.h @@ -165,7 +165,7 @@ void IndicesCooKernel(const Context& dev_ctx UNUSED, } template -void SparseCooTensorKernel(const Context& dev_ctx, +void SparseCooTensorKernel(const Context& dev_ctx UNUSED, const DenseTensor& values, const DenseTensor& indices, const std::vector& shape,