Skip to content

Commit

Permalink
fix test_inplace
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatV committed Jan 9, 2024
1 parent 8f96075 commit d7c1b59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions python/paddle/tensor/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -5150,7 +5150,7 @@ def gammaincc_(x, a, name=None):
Please refer to :ref:`api_paddle_gammaincc`.
"""
if in_dynamic_mode():
return _C_ops.gammaincc_(x, a)
return _C_ops.igamma_(x, a)


def gammainc(x, a, name=None):
Expand Down Expand Up @@ -5189,7 +5189,7 @@ def gammainc_(x, a, name=None):
Please refer to :ref:`api_paddle_gammainc`.
"""
return (
paddle.igamma_(x, a)
paddle.gammaincc_(x, a)
.multiply_(paddle.full_like(x, -1.0))
.add_(paddle.full_like(x, 1.0))
)
Expand Down
12 changes: 6 additions & 6 deletions test/legacy_test/test_inplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ def non_inplace_api_processing(self, var):
return paddle.neg(var)


class TestDygraphInplaceIgamma(TestDygraphInplaceWithContinuous):
class TestDygraphInplaceGammaincc(TestDygraphInplaceWithContinuous):
def init_data(self):
self.shape = (3, 40)
self.dtype = "float32"
Expand All @@ -895,13 +895,13 @@ def init_data(self):
self.a = paddle.rand(shape=self.shape, dtype=self.dtype) + 1

def inplace_api_processing(self, var):
return paddle.igamma_(var, a=self.a)
return paddle.gammaincc_(var, a=self.a)

def non_inplace_api_processing(self, var):
return paddle.igamma(var, a=self.a)
return paddle.gammaincc(var, a=self.a)


class TestDygraphInplaceIgammac(TestDygraphInplaceWithContinuous):
class TestDygraphInplaceGammainc(TestDygraphInplaceWithContinuous):
def init_data(self):
self.shape = (3, 40)
self.dtype = "float32"
Expand All @@ -911,10 +911,10 @@ def init_data(self):
self.a = paddle.rand(shape=self.shape, dtype=self.dtype) + 1

def inplace_api_processing(self, var):
return paddle.igammac_(var, a=self.a)
return paddle.gammainc_(var, a=self.a)

def non_inplace_api_processing(self, var):
return paddle.igammac(var, a=self.a)
return paddle.gammainc(var, a=self.a)

def test_forward_version(self):
with paddle.base.dygraph.guard():
Expand Down

0 comments on commit d7c1b59

Please sign in to comment.