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

[CodeStyle][Typos][E-28] Fix typo extream #70459

Merged
merged 1 commit into from
Dec 25, 2024
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
1 change: 0 additions & 1 deletion _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ expaned = 'expaned'
epxand = 'epxand'
Expexted = 'Expexted'
expolitation = 'expolitation'
extream = 'extream'
faild = 'faild'
Flase = 'Flase'
featue = 'featue'
Expand Down
6 changes: 3 additions & 3 deletions test/deprecated/legacy_test/test_bfgs_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ def func(x):
)

def test_inf_minima(self):
extream_point = np.array([-1, 2]).astype('float32')
extreme_point = np.array([-1, 2]).astype('float32')

def func(x):
# df = 3(x - 1.01)(x - 0.99)
# f = x^3 - 3x^2 + 3*1.01*0.99x
return (
x * x * x / 3.0
- (extream_point[0] + extream_point[1]) * x * x / 2
+ extream_point[0] * extream_point[1] * x
- (extreme_point[0] + extreme_point[1]) * x * x / 2
+ extreme_point[0] * extreme_point[1] * x
)

x0 = np.array([-1.7]).astype('float32')
Expand Down
6 changes: 3 additions & 3 deletions test/deprecated/legacy_test/test_lbfgs_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ def func(x):
np.testing.assert_allclose(minimum, results[2].numpy(), rtol=1e-05)

def test_inf_minima(self):
extream_point = np.array([-1, 2]).astype('float32')
extreme_point = np.array([-1, 2]).astype('float32')

def func(x):
# df = 3(x - 1.01)(x - 0.99)
# f = x^3 - 3x^2 + 3*1.01*0.99x
return (
x * x * x / 3.0
- (extream_point[0] + extream_point[1]) * x * x / 2
+ extream_point[0] * extream_point[1] * x
- (extreme_point[0] + extreme_point[1]) * x * x / 2
+ extreme_point[0] * extreme_point[1] * x
)

x0 = np.array([-1.7]).astype('float32')
Expand Down
76 changes: 38 additions & 38 deletions test/legacy_test/test_lbfgs_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,18 @@ def outputs2(x):
targets = [outputs1(input), outputs2(input)]
input = paddle.to_tensor(input)

def func1(extream_point, x):
def func1(extreme_point, x):
return (
x * x * x
- 3 * x * x
+ 3 * extream_point[0] * extream_point[1] * x
+ 3 * extreme_point[0] * extreme_point[1] * x
)

def func2(extream_point, x):
return pow(x, extream_point[0]) + 5 * pow(x, extream_point[1])
def func2(extreme_point, x):
return pow(x, extreme_point[0]) + 5 * pow(x, extreme_point[1])

extream_point = np.array([-2.34, 1.45]).astype('float32')
net1 = Net(extream_point, func1)
extreme_point = np.array([-2.34, 1.45]).astype('float32')
net1 = Net(extreme_point, func1)
# converge of old_sk.pop()
opt1 = incubate_lbfgs.LBFGS(
learning_rate=1,
Expand All @@ -127,7 +127,7 @@ def func2(extream_point, x):
parameters=net1.parameters(),
)

net2 = Net(extream_point, func2)
net2 = Net(extreme_point, func2)
# converge of line_search = None
opt2 = incubate_lbfgs.LBFGS(
learning_rate=1,
Expand All @@ -153,8 +153,8 @@ def func2(extream_point, x):
def test_error_incubate(self):
# test parameter is not Paddle Tensor
def error_func1():
extream_point = np.array([-1, 2]).astype('float32')
extream_point = paddle.to_tensor(extream_point)
extreme_point = np.array([-1, 2]).astype('float32')
extreme_point = paddle.to_tensor(extreme_point)
return incubate_lbfgs.LBFGS(
learning_rate=1,
max_iter=10,
Expand All @@ -163,7 +163,7 @@ def error_func1():
tolerance_change=1e-09,
history_size=3,
line_search_fn='strong_wolfe',
parameters=extream_point,
parameters=extreme_point,
)

self.assertRaises(TypeError, error_func1)
Expand All @@ -179,11 +179,11 @@ def outputs2(x):
targets = [outputs2(input)]
input = paddle.to_tensor(input)

def func2(extream_point, x):
return pow(x, extream_point[0]) + 5 * pow(x, extream_point[1])
def func2(extreme_point, x):
return pow(x, extreme_point[0]) + 5 * pow(x, extreme_point[1])

extream_point = np.array([-2.34, 1.45]).astype('float32')
net2 = Net(extream_point, func2)
extreme_point = np.array([-2.34, 1.45]).astype('float32')
net2 = Net(extreme_point, func2)
# converge of line_search = None
opt2 = incubate_lbfgs.LBFGS(
learning_rate=1,
Expand Down Expand Up @@ -283,13 +283,13 @@ def func3(x, alpha, d):
def test_error3_incubate(self):
# test parameter shape size <= 0
def error_func3():
extream_point = np.array([-1, 2]).astype('float32')
extream_point = paddle.to_tensor(extream_point)
extreme_point = np.array([-1, 2]).astype('float32')
extreme_point = paddle.to_tensor(extreme_point)

def func(w, x):
return w * x

net = Net(extream_point, func)
net = Net(extreme_point, func)
net.w = paddle.create_parameter(
shape=[-1, 2],
dtype=net.w.dtype,
Expand Down Expand Up @@ -353,18 +353,18 @@ def outputs2(x):
targets = [outputs1(input), outputs2(input)]
input = paddle.to_tensor(input)

def func1(extream_point, x):
def func1(extreme_point, x):
return (
x * x * x
- 3 * x * x
+ 3 * extream_point[0] * extream_point[1] * x
+ 3 * extreme_point[0] * extreme_point[1] * x
)

def func2(extream_point, x):
return pow(x, extream_point[0]) + 5 * pow(x, extream_point[1])
def func2(extreme_point, x):
return pow(x, extreme_point[0]) + 5 * pow(x, extreme_point[1])

extream_point = np.array([-2.34, 1.45]).astype('float32')
net1 = Net(extream_point, func1)
extreme_point = np.array([-2.34, 1.45]).astype('float32')
net1 = Net(extreme_point, func1)
# converge of old_sk.pop()
opt1 = lbfgs.LBFGS(
learning_rate=1,
Expand All @@ -377,7 +377,7 @@ def func2(extream_point, x):
parameters=net1.parameters(),
)

net2 = Net(extream_point, func2)
net2 = Net(extreme_point, func2)
# converge of line_search = None
opt2 = lbfgs.LBFGS(
learning_rate=1,
Expand All @@ -403,8 +403,8 @@ def func2(extream_point, x):
def test_error(self):
# test parameter is not Paddle Tensor
def error_func1():
extream_point = np.array([-1, 2]).astype('float32')
extream_point = paddle.to_tensor(extream_point)
extreme_point = np.array([-1, 2]).astype('float32')
extreme_point = paddle.to_tensor(extreme_point)
return lbfgs.LBFGS(
learning_rate=1,
max_iter=10,
Expand All @@ -413,7 +413,7 @@ def error_func1():
tolerance_change=1e-09,
history_size=3,
line_search_fn='strong_wolfe',
parameters=extream_point,
parameters=extreme_point,
)

self.assertRaises(TypeError, error_func1)
Expand All @@ -429,11 +429,11 @@ def outputs2(x):
targets = [outputs2(input)]
input = paddle.to_tensor(input)

def func2(extream_point, x):
return pow(x, extream_point[0]) + 5 * pow(x, extream_point[1])
def func2(extreme_point, x):
return pow(x, extreme_point[0]) + 5 * pow(x, extreme_point[1])

extream_point = np.array([-2.34, 1.45]).astype('float32')
net2 = Net(extream_point, func2)
extreme_point = np.array([-2.34, 1.45]).astype('float32')
net2 = Net(extreme_point, func2)
# converge of line_search = None
opt2 = lbfgs.LBFGS(
learning_rate=1,
Expand Down Expand Up @@ -543,13 +543,13 @@ def func3(x, alpha, d):
def test_error3(self):
# test parameter shape size <= 0
def error_func3():
extream_point = np.array([-1, 2]).astype('float32')
extream_point = paddle.to_tensor(extream_point)
extreme_point = np.array([-1, 2]).astype('float32')
extreme_point = paddle.to_tensor(extreme_point)

def func(w, x):
return w * x

net = Net(extream_point, func)
net = Net(extreme_point, func)
net.w = paddle.create_parameter(
shape=[-1, 2],
dtype=net.w.dtype,
Expand All @@ -576,12 +576,12 @@ def error_func4():
targets = paddle.to_tensor([inputs * 2])
inputs = paddle.to_tensor(inputs)

extream_point = np.array([-1, 1]).astype('float32')
extreme_point = np.array([-1, 1]).astype('float32')

def func(extream_point, x):
return x * extream_point[0] + 5 * x * extream_point[1]
def func(extreme_point, x):
return x * extreme_point[0] + 5 * x * extreme_point[1]

net = Net(extream_point, func)
net = Net(extreme_point, func)
opt = lbfgs.LBFGS(
learning_rate=1,
max_iter=10,
Expand Down
Loading