Skip to content

Commit a490e95

Browse files
authored
[CodeStyle][Typos][E-28] Fix typo extream (PaddlePaddle#70459)
1 parent 967948f commit a490e95

File tree

4 files changed

+44
-45
lines changed

4 files changed

+44
-45
lines changed

_typos.toml

-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ expaned = 'expaned'
105105
epxand = 'epxand'
106106
Expexted = 'Expexted'
107107
expolitation = 'expolitation'
108-
extream = 'extream'
109108
faild = 'faild'
110109
Flase = 'Flase'
111110
featue = 'featue'

test/deprecated/legacy_test/test_bfgs_deprecated.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ def func(x):
9696
)
9797

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

101101
def func(x):
102102
# df = 3(x - 1.01)(x - 0.99)
103103
# f = x^3 - 3x^2 + 3*1.01*0.99x
104104
return (
105105
x * x * x / 3.0
106-
- (extream_point[0] + extream_point[1]) * x * x / 2
107-
+ extream_point[0] * extream_point[1] * x
106+
- (extreme_point[0] + extreme_point[1]) * x * x / 2
107+
+ extreme_point[0] * extreme_point[1] * x
108108
)
109109

110110
x0 = np.array([-1.7]).astype('float32')

test/deprecated/legacy_test/test_lbfgs_deprecated.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ def func(x):
9292
np.testing.assert_allclose(minimum, results[2].numpy(), rtol=1e-05)
9393

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

9797
def func(x):
9898
# df = 3(x - 1.01)(x - 0.99)
9999
# f = x^3 - 3x^2 + 3*1.01*0.99x
100100
return (
101101
x * x * x / 3.0
102-
- (extream_point[0] + extream_point[1]) * x * x / 2
103-
+ extream_point[0] * extream_point[1] * x
102+
- (extreme_point[0] + extreme_point[1]) * x * x / 2
103+
+ extreme_point[0] * extreme_point[1] * x
104104
)
105105

106106
x0 = np.array([-1.7]).astype('float32')

test/legacy_test/test_lbfgs_class.py

+38-38
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,18 @@ def outputs2(x):
103103
targets = [outputs1(input), outputs2(input)]
104104
input = paddle.to_tensor(input)
105105

106-
def func1(extream_point, x):
106+
def func1(extreme_point, x):
107107
return (
108108
x * x * x
109109
- 3 * x * x
110-
+ 3 * extream_point[0] * extream_point[1] * x
110+
+ 3 * extreme_point[0] * extreme_point[1] * x
111111
)
112112

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

116-
extream_point = np.array([-2.34, 1.45]).astype('float32')
117-
net1 = Net(extream_point, func1)
116+
extreme_point = np.array([-2.34, 1.45]).astype('float32')
117+
net1 = Net(extreme_point, func1)
118118
# converge of old_sk.pop()
119119
opt1 = incubate_lbfgs.LBFGS(
120120
learning_rate=1,
@@ -127,7 +127,7 @@ def func2(extream_point, x):
127127
parameters=net1.parameters(),
128128
)
129129

130-
net2 = Net(extream_point, func2)
130+
net2 = Net(extreme_point, func2)
131131
# converge of line_search = None
132132
opt2 = incubate_lbfgs.LBFGS(
133133
learning_rate=1,
@@ -153,8 +153,8 @@ def func2(extream_point, x):
153153
def test_error_incubate(self):
154154
# test parameter is not Paddle Tensor
155155
def error_func1():
156-
extream_point = np.array([-1, 2]).astype('float32')
157-
extream_point = paddle.to_tensor(extream_point)
156+
extreme_point = np.array([-1, 2]).astype('float32')
157+
extreme_point = paddle.to_tensor(extreme_point)
158158
return incubate_lbfgs.LBFGS(
159159
learning_rate=1,
160160
max_iter=10,
@@ -163,7 +163,7 @@ def error_func1():
163163
tolerance_change=1e-09,
164164
history_size=3,
165165
line_search_fn='strong_wolfe',
166-
parameters=extream_point,
166+
parameters=extreme_point,
167167
)
168168

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

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

185-
extream_point = np.array([-2.34, 1.45]).astype('float32')
186-
net2 = Net(extream_point, func2)
185+
extreme_point = np.array([-2.34, 1.45]).astype('float32')
186+
net2 = Net(extreme_point, func2)
187187
# converge of line_search = None
188188
opt2 = incubate_lbfgs.LBFGS(
189189
learning_rate=1,
@@ -283,13 +283,13 @@ def func3(x, alpha, d):
283283
def test_error3_incubate(self):
284284
# test parameter shape size <= 0
285285
def error_func3():
286-
extream_point = np.array([-1, 2]).astype('float32')
287-
extream_point = paddle.to_tensor(extream_point)
286+
extreme_point = np.array([-1, 2]).astype('float32')
287+
extreme_point = paddle.to_tensor(extreme_point)
288288

289289
def func(w, x):
290290
return w * x
291291

292-
net = Net(extream_point, func)
292+
net = Net(extreme_point, func)
293293
net.w = paddle.create_parameter(
294294
shape=[-1, 2],
295295
dtype=net.w.dtype,
@@ -353,18 +353,18 @@ def outputs2(x):
353353
targets = [outputs1(input), outputs2(input)]
354354
input = paddle.to_tensor(input)
355355

356-
def func1(extream_point, x):
356+
def func1(extreme_point, x):
357357
return (
358358
x * x * x
359359
- 3 * x * x
360-
+ 3 * extream_point[0] * extream_point[1] * x
360+
+ 3 * extreme_point[0] * extreme_point[1] * x
361361
)
362362

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

366-
extream_point = np.array([-2.34, 1.45]).astype('float32')
367-
net1 = Net(extream_point, func1)
366+
extreme_point = np.array([-2.34, 1.45]).astype('float32')
367+
net1 = Net(extreme_point, func1)
368368
# converge of old_sk.pop()
369369
opt1 = lbfgs.LBFGS(
370370
learning_rate=1,
@@ -377,7 +377,7 @@ def func2(extream_point, x):
377377
parameters=net1.parameters(),
378378
)
379379

380-
net2 = Net(extream_point, func2)
380+
net2 = Net(extreme_point, func2)
381381
# converge of line_search = None
382382
opt2 = lbfgs.LBFGS(
383383
learning_rate=1,
@@ -403,8 +403,8 @@ def func2(extream_point, x):
403403
def test_error(self):
404404
# test parameter is not Paddle Tensor
405405
def error_func1():
406-
extream_point = np.array([-1, 2]).astype('float32')
407-
extream_point = paddle.to_tensor(extream_point)
406+
extreme_point = np.array([-1, 2]).astype('float32')
407+
extreme_point = paddle.to_tensor(extreme_point)
408408
return lbfgs.LBFGS(
409409
learning_rate=1,
410410
max_iter=10,
@@ -413,7 +413,7 @@ def error_func1():
413413
tolerance_change=1e-09,
414414
history_size=3,
415415
line_search_fn='strong_wolfe',
416-
parameters=extream_point,
416+
parameters=extreme_point,
417417
)
418418

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

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

435-
extream_point = np.array([-2.34, 1.45]).astype('float32')
436-
net2 = Net(extream_point, func2)
435+
extreme_point = np.array([-2.34, 1.45]).astype('float32')
436+
net2 = Net(extreme_point, func2)
437437
# converge of line_search = None
438438
opt2 = lbfgs.LBFGS(
439439
learning_rate=1,
@@ -543,13 +543,13 @@ def func3(x, alpha, d):
543543
def test_error3(self):
544544
# test parameter shape size <= 0
545545
def error_func3():
546-
extream_point = np.array([-1, 2]).astype('float32')
547-
extream_point = paddle.to_tensor(extream_point)
546+
extreme_point = np.array([-1, 2]).astype('float32')
547+
extreme_point = paddle.to_tensor(extreme_point)
548548

549549
def func(w, x):
550550
return w * x
551551

552-
net = Net(extream_point, func)
552+
net = Net(extreme_point, func)
553553
net.w = paddle.create_parameter(
554554
shape=[-1, 2],
555555
dtype=net.w.dtype,
@@ -576,12 +576,12 @@ def error_func4():
576576
targets = paddle.to_tensor([inputs * 2])
577577
inputs = paddle.to_tensor(inputs)
578578

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

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

584-
net = Net(extream_point, func)
584+
net = Net(extreme_point, func)
585585
opt = lbfgs.LBFGS(
586586
learning_rate=1,
587587
max_iter=10,

0 commit comments

Comments
 (0)