Skip to content

Commit

Permalink
fix: maximum type error & ban cinn test
Browse files Browse the repository at this point in the history
  • Loading branch information
Miracle2333 committed Feb 23, 2023
1 parent 4ee264d commit 9643c5d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions python/paddle/fluid/tests/unittests/test_activation_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -1569,9 +1569,9 @@ def test_check_grad(self):

def test_check_output(self):
self.check_output(check_prim=True)

def skip_cinn(self):
pass
self.enable_cinn = False


class TestRelu_ZeroDim(TestRelu):
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/incubate/autograd/composite_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@ def bernoulli(shape, dtype, p, seed=0):
def relu_composite(x):
"""define composite rule of op relu."""
# relu(x) = max(x, 0)
return maximum(0, x)
return maximum(zeros_like(x), x)
4 changes: 3 additions & 1 deletion python/paddle/incubate/autograd/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from paddle.tensor import logit # noqa: F401
from paddle.tensor import logsumexp # noqa: F401
from paddle.tensor import max # noqa: F401
from paddle.tensor import maximum # noqa: F401
from paddle.tensor import mean # noqa: F401
from paddle.tensor import min # noqa: F401
from paddle.tensor import multiply # noqa: F401
Expand All @@ -59,8 +60,8 @@
from paddle.tensor import uniform # noqa: F401
from paddle.tensor import zeros # noqa: F401
from paddle.tensor.creation import assign # noqa: F401
from paddle.tensor.creation import zeros_like # noqa: F401
from paddle.tensor.manipulation import cast # noqa: F401
from paddle.tensor import maximum # noqa: F401

"""
math_op = [
Expand Down Expand Up @@ -122,5 +123,6 @@
'full',
'uniform',
'greater_equal',
'zeros_like',
]
"""

0 comments on commit 9643c5d

Please sign in to comment.