Skip to content

Commit

Permalink
rename op
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatV committed Jan 23, 2024
1 parent cb34836 commit af72a5c
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 59 deletions.
20 changes: 10 additions & 10 deletions paddle/phi/api/yaml/backward.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,16 @@
kernel :
func : frame_grad

- backward_op : gammaincc_grad
forward : gammaincc(Tensor x, Tensor a) -> Tensor(out)
args : (Tensor x, Tensor a, Tensor out_grad)
output : Tensor(x_grad)
infer_meta :
func : UnchangedInferMeta
param : [x]
kernel :
func : gammaincc_grad

- backward_op : gammaln_grad
forward : gammaln(Tensor x) -> Tensor(out)
args : (Tensor x, Tensor out_grad)
Expand Down Expand Up @@ -1148,16 +1158,6 @@
data_type : out_grad
inplace : (out_grad -> x_grad)

- backward_op : igamma_grad
forward : igamma(Tensor x, Tensor a) -> Tensor(out)
args : (Tensor x, Tensor a, Tensor out_grad)
output : Tensor(x_grad)
infer_meta :
func : UnchangedInferMeta
param : [x]
kernel :
func : igamma_grad

- backward_op : imag_grad
forward : imag (Tensor x) -> Tensor(out)
args : (Tensor out_grad)
Expand Down
22 changes: 11 additions & 11 deletions paddle/phi/api/yaml/ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,17 @@
backend : place
interfaces : paddle::dialect::InferSymbolicShapeInterface

- op : gammaincc
args : (Tensor x, Tensor a)
output : Tensor(out)
infer_meta :
func : ElementwiseInferMeta
param : [x, a]
kernel :
func : gammaincc
inplace: (x -> out)
backward : gammaincc_grad

- op : gammaln
args : (Tensor x)
output : Tensor(out)
Expand Down Expand Up @@ -1311,17 +1322,6 @@
inplace: (x -> out)
backward : identity_loss_grad

- op : igamma
args : (Tensor x, Tensor a)
output : Tensor(out)
infer_meta :
func : ElementwiseInferMeta
param : [x, a]
kernel :
func : igamma
inplace: (x -> out)
backward : igamma_grad

- op : imag
args : (Tensor x)
output : Tensor (out)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "paddle/phi/kernels/igamma_kernel.h"

#include "paddle/phi/kernels/gammaincc_grad_kernel.h"
#include "paddle/phi/backends/cpu/cpu_context.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/impl/gammaincc_grad_kernel_impl.h"

#include "paddle/phi/kernels/impl/igamma_kernel_impl.h"

PD_REGISTER_KERNEL(igamma, CPU, ALL_LAYOUT, phi::IgammaKernel, float, double) {}
PD_REGISTER_KERNEL(
gammaincc_grad, CPU, ALL_LAYOUT, phi::GammainccGradKernel, float, double) {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
// Copyright (c) 2023 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.
Expand All @@ -12,11 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "paddle/phi/kernels/igamma_grad_kernel.h"
#include "paddle/phi/kernels/gammaincc_kernel.h"

#include "paddle/phi/backends/cpu/cpu_context.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/impl/igamma_grad_kernel_impl.h"

#include "paddle/phi/kernels/impl/gammaincc_kernel_impl.h"

PD_REGISTER_KERNEL(
igamma_grad, CPU, ALL_LAYOUT, phi::IgammaGradKernel, float, double) {}
gammaincc, CPU, ALL_LAYOUT, phi::GammainccKernel, float, double) {}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
namespace phi {

template <typename T, typename Context>
void IgammaGradKernel(const Context& dev_ctx,
const DenseTensor& x,
const DenseTensor& a,
const DenseTensor& d_out,
DenseTensor* d_x);
void GammainccGradKernel(const Context& dev_ctx,
const DenseTensor& x,
const DenseTensor& a,
const DenseTensor& d_out,
DenseTensor* d_x);
} // namespace phi
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
namespace phi {

template <typename T, typename Context>
void IgammaKernel(const Context& dev_ctx,
const DenseTensor& x,
const DenseTensor& a,
DenseTensor* out);
void GammainccKernel(const Context& dev_ctx,
const DenseTensor& x,
const DenseTensor& a,
DenseTensor* out);
} // namespace phi
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "paddle/phi/kernels/igamma_kernel.h"
#include "paddle/phi/kernels/gammaincc_kernel.h"

#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/core/kernel_registry.h"

#include "paddle/phi/kernels/impl/igamma_kernel_impl.h"
#include "paddle/phi/kernels/impl/gammaincc_kernel_impl.h"

PD_REGISTER_KERNEL(igamma, GPU, ALL_LAYOUT, phi::IgammaKernel, float, double) {}
PD_REGISTER_KERNEL(
gammaincc, GPU, ALL_LAYOUT, phi::GammainccKernel, float, double) {}
7 changes: 3 additions & 4 deletions paddle/phi/kernels/gpu/igamma_grad_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "paddle/phi/kernels/igamma_grad_kernel.h"

#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/impl/igamma_grad_kernel_impl.h"
#include "paddle/phi/kernels/gammaincc_grad_kernel.h"
#include "paddle/phi/kernels/impl/gammaincc_grad_kernel_impl.h"

PD_REGISTER_KERNEL(
igamma_grad, GPU, ALL_LAYOUT, phi::IgammaGradKernel, float, double) {}
gammaincc_grad, GPU, ALL_LAYOUT, phi::GammainccGradKernel, float, double) {}
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ struct IgammaGradFunctor {
};

template <typename T, typename Context>
void IgammaGradKernel(const Context& dev_ctx,
const DenseTensor& x,
const DenseTensor& a,
const DenseTensor& d_out,
DenseTensor* d_x) {
void GammainccGradKernel(const Context& dev_ctx,
const DenseTensor& x,
const DenseTensor& a,
const DenseTensor& d_out,
DenseTensor* d_x) {
auto numel = d_out.numel();
auto* dout_data = d_out.data<T>();
auto* x_data = x.data<T>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ struct IgammaFunctor {
};

template <typename T, typename Context>
void IgammaKernel(const Context& dev_ctx,
const DenseTensor& x,
const DenseTensor& a,
DenseTensor* out) {
void GammainccKernel(const Context& dev_ctx,
const DenseTensor& x,
const DenseTensor& a,
DenseTensor* out) {
auto numel = x.numel();
auto* x_data = x.data<T>();
auto* a_data = a.data<T>();
Expand Down
6 changes: 3 additions & 3 deletions python/paddle/tensor/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -5135,14 +5135,14 @@ def gammaincc(x, a, name=None):
"The input argument x must be greater than or equal to 0."
)
if in_dynamic_or_pir_mode():
return _C_ops.igamma(x, a)
return _C_ops.gammaincc(x, a)
else:
check_variable_and_dtype(x, 'x', ['float32', 'float64'], 'gammaincc')
check_variable_and_dtype(a, 'a', ['float32', 'float64'], 'gammaincc')
helper = LayerHelper('gammaincc', **locals())
out = helper.create_variable_for_type_inference(x.dtype)
helper.append_op(
type='igamma', inputs={'x': x, 'a': a}, outputs={'out': out}
type='gammaincc', inputs={'x': x, 'a': a}, outputs={'out': out}
)
return out

Expand All @@ -5154,7 +5154,7 @@ def gammaincc_(x, a, name=None):
Please refer to :ref:`api_paddle_gammaincc`.
"""
if in_dynamic_mode():
return _C_ops.igamma_(x, a)
return _C_ops.gammaincc_(x, a)


def gammainc(x, a, name=None):
Expand Down
2 changes: 1 addition & 1 deletion test/legacy_test/test_gammaincc_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def ref_gammaincc(x, a):

class TestGammainccOp(OpTest):
def setUp(self):
self.op_type = 'igamma'
self.op_type = 'gammaincc'
self.python_api = paddle.gammaincc
self.init_dtype_type()
self.shape = (3, 40)
Expand Down

0 comments on commit af72a5c

Please sign in to comment.