Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo (dynamic_guad -> dynamic_guard) #61749

Merged
merged 1 commit into from
Feb 21, 2024
Merged
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
48 changes: 24 additions & 24 deletions test/legacy_test/test_activation_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


@contextmanager
def dynamic_guad():
def dynamic_guard():
paddle.disable_static()
try:
yield
Expand Down Expand Up @@ -327,7 +327,7 @@ def run(place):
run(place)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():

def run(place):
X = paddle.to_tensor(self.x)
Expand Down Expand Up @@ -880,7 +880,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.tanh(x)
out2 = paddle.tanh(x)
Expand Down Expand Up @@ -1297,7 +1297,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.tanhshrink(x)
tanhshrink = paddle.nn.Tanhshrink()
Expand Down Expand Up @@ -1408,7 +1408,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.hardshrink(x)
hd = paddle.nn.Hardshrink()
Expand Down Expand Up @@ -1476,7 +1476,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.hardtanh(x)
m = paddle.nn.Hardtanh()
Expand Down Expand Up @@ -1581,7 +1581,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.softshrink(x, self.threshold)
softshrink = paddle.nn.Softshrink(self.threshold)
Expand Down Expand Up @@ -2194,7 +2194,7 @@ def setUp(self):
)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out_test = paddle.tan(x)
out_ref = np.tan(self.x_np)
Expand Down Expand Up @@ -2693,7 +2693,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
m = paddle.nn.ReLU()
out1 = m(x)
Expand Down Expand Up @@ -2830,7 +2830,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.leaky_relu(x)
m = paddle.nn.LeakyReLU()
Expand Down Expand Up @@ -3013,7 +3013,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.gelu(x)
m = paddle.nn.GELU()
Expand Down Expand Up @@ -3149,7 +3149,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.relu6(x)
relu6 = paddle.nn.ReLU6()
Expand Down Expand Up @@ -3329,7 +3329,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor([11648.0, 11448.0])
out1 = F.hardswish(x)
m = paddle.nn.Hardswish()
Expand All @@ -3349,7 +3349,7 @@ def test_base_api(self):
out_ref = ref_hardswish(self.x_np)
np.testing.assert_allclose(out_ref, res[0], rtol=1e-05)

with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out = paddle.nn.functional.hardswish(x)
np.testing.assert_allclose(out_ref, out.numpy(), rtol=1e-05)
Expand Down Expand Up @@ -3488,7 +3488,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = self.elu(x)
x = paddle.to_tensor(self.x_np)
Expand Down Expand Up @@ -3530,7 +3530,7 @@ def executed_api(self):
self.elu = F.elu_

def test_alpha_error(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
self.assertRaises(Exception, F.elu_, x, -0.2)

Expand Down Expand Up @@ -3603,7 +3603,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = self.celu(x, 1.5)
x = paddle.to_tensor(self.x_np)
Expand Down Expand Up @@ -4366,7 +4366,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out = paddle.stanh(x, self.scale_a, self.scale_b)
out_ref = ref_stanh(self.x_np, self.scale_a, self.scale_b)
Expand Down Expand Up @@ -4548,7 +4548,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.softplus(x, self.beta, self.threshold)
softplus = paddle.nn.Softplus(self.beta, self.threshold)
Expand Down Expand Up @@ -4659,7 +4659,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.softsign(x)
softsign = paddle.nn.Softsign()
Expand Down Expand Up @@ -4760,7 +4760,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.thresholded_relu(x, self.threshold)
thresholded_relu = paddle.nn.ThresholdedReLU(self.threshold)
Expand Down Expand Up @@ -4879,7 +4879,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.hardsigmoid(x)
m = paddle.nn.Hardsigmoid()
Expand Down Expand Up @@ -4985,7 +4985,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.swish(x)
swish = paddle.nn.Swish()
Expand Down Expand Up @@ -5093,7 +5093,7 @@ def test_static_api(self):
np.testing.assert_allclose(out_ref, r, rtol=1e-05)

def test_dygraph_api(self):
with dynamic_guad():
with dynamic_guard():
x = paddle.to_tensor(self.x_np)
out1 = F.mish(x)
mish = paddle.nn.Mish()
Expand Down