diff --git a/paddle/phi/kernels/cpu/l1_norm_grad_kernel.cc b/paddle/phi/kernels/cpu/l1_norm_grad_kernel.cc index d1ea0c59493638..672f0aff260e2d 100644 --- a/paddle/phi/kernels/cpu/l1_norm_grad_kernel.cc +++ b/paddle/phi/kernels/cpu/l1_norm_grad_kernel.cc @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - +#include "paddle/phi/kernels/l1_norm_grad_kernel.h" #include "paddle/phi/kernels/funcs/eigen/common.h" #include "paddle/phi/kernels/funcs/eigen/eigen_function.h" #include "paddle/phi/kernels/l1_norm_kernel.h" diff --git a/paddle/phi/kernels/gpu/l1_norm_grad_kernel.cu b/paddle/phi/kernels/gpu/l1_norm_grad_kernel.cu index b5ddbbeea4d4da..2ba73018713a37 100644 --- a/paddle/phi/kernels/gpu/l1_norm_grad_kernel.cu +++ b/paddle/phi/kernels/gpu/l1_norm_grad_kernel.cu @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - +#include "paddle/phi/kernels/l1_norm_grad_kernel.h" #include "paddle/phi/kernels/funcs/eigen/common.h" #include "paddle/phi/kernels/funcs/eigen/eigen_function.h" #include "paddle/phi/kernels/l1_norm_kernel.h" diff --git a/paddle/phi/kernels/l1_norm_grad_kernel.h b/paddle/phi/kernels/l1_norm_grad_kernel.h new file mode 100644 index 00000000000000..4de8e8e0b43d1e --- /dev/null +++ b/paddle/phi/kernels/l1_norm_grad_kernel.h @@ -0,0 +1,33 @@ +// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include "paddle/phi/core/dense_tensor.h" +#include "paddle/phi/core/device_context.h" + +namespace phi { + +template +void L1NormKernel(const Context& dev_ctx, + const DenseTensor& x, + DenseTensor* out); + +template +void L1NormGradKernel(const Context& dev_ctx, + const DenseTensor& x, + const DenseTensor& out_grad, + DenseTensor* x_grad); + +} // namespace phi