Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/paddle/nn/functional/activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ def swish(x, name=None):
Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
[-0.23840584, 0. , 0.73105860])
"""
if in_dynamic_mode():
if in_dynamic_or_pir_mode():
return _C_ops.swish(x)
else:
check_variable_and_dtype(
Expand Down
3 changes: 3 additions & 0 deletions test/legacy_test/test_activation_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -4428,6 +4428,7 @@ def test_check_grad(self):
self.check_grad(
['X'],
'Out',
check_pir=True,
)


Expand All @@ -4447,6 +4448,7 @@ def setUp(self):
else paddle.CPUPlace()
)

@test_with_pir_api
def test_static_api(self):
with static_guard():
with paddle.static.program_guard(paddle.static.Program()):
Expand All @@ -4470,6 +4472,7 @@ def test_dygraph_api(self):
for r in [out1, out2]:
np.testing.assert_allclose(out_ref, r.numpy(), rtol=1e-05)

@test_with_pir_api
def test_base_api(self):
with static_guard():
with base.program_guard(base.Program()):
Expand Down