@@ -103,18 +103,18 @@ def outputs2(x):
103
103
targets = [outputs1 (input ), outputs2 (input )]
104
104
input = paddle .to_tensor (input )
105
105
106
- def func1 (extream_point , x ):
106
+ def func1 (extreme_point , x ):
107
107
return (
108
108
x * x * x
109
109
- 3 * x * x
110
- + 3 * extream_point [0 ] * extream_point [1 ] * x
110
+ + 3 * extreme_point [0 ] * extreme_point [1 ] * x
111
111
)
112
112
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 ])
115
115
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 )
118
118
# converge of old_sk.pop()
119
119
opt1 = incubate_lbfgs .LBFGS (
120
120
learning_rate = 1 ,
@@ -127,7 +127,7 @@ def func2(extream_point, x):
127
127
parameters = net1 .parameters (),
128
128
)
129
129
130
- net2 = Net (extream_point , func2 )
130
+ net2 = Net (extreme_point , func2 )
131
131
# converge of line_search = None
132
132
opt2 = incubate_lbfgs .LBFGS (
133
133
learning_rate = 1 ,
@@ -153,8 +153,8 @@ def func2(extream_point, x):
153
153
def test_error_incubate (self ):
154
154
# test parameter is not Paddle Tensor
155
155
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 )
158
158
return incubate_lbfgs .LBFGS (
159
159
learning_rate = 1 ,
160
160
max_iter = 10 ,
@@ -163,7 +163,7 @@ def error_func1():
163
163
tolerance_change = 1e-09 ,
164
164
history_size = 3 ,
165
165
line_search_fn = 'strong_wolfe' ,
166
- parameters = extream_point ,
166
+ parameters = extreme_point ,
167
167
)
168
168
169
169
self .assertRaises (TypeError , error_func1 )
@@ -179,11 +179,11 @@ def outputs2(x):
179
179
targets = [outputs2 (input )]
180
180
input = paddle .to_tensor (input )
181
181
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 ])
184
184
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 )
187
187
# converge of line_search = None
188
188
opt2 = incubate_lbfgs .LBFGS (
189
189
learning_rate = 1 ,
@@ -283,13 +283,13 @@ def func3(x, alpha, d):
283
283
def test_error3_incubate (self ):
284
284
# test parameter shape size <= 0
285
285
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 )
288
288
289
289
def func (w , x ):
290
290
return w * x
291
291
292
- net = Net (extream_point , func )
292
+ net = Net (extreme_point , func )
293
293
net .w = paddle .create_parameter (
294
294
shape = [- 1 , 2 ],
295
295
dtype = net .w .dtype ,
@@ -353,18 +353,18 @@ def outputs2(x):
353
353
targets = [outputs1 (input ), outputs2 (input )]
354
354
input = paddle .to_tensor (input )
355
355
356
- def func1 (extream_point , x ):
356
+ def func1 (extreme_point , x ):
357
357
return (
358
358
x * x * x
359
359
- 3 * x * x
360
- + 3 * extream_point [0 ] * extream_point [1 ] * x
360
+ + 3 * extreme_point [0 ] * extreme_point [1 ] * x
361
361
)
362
362
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 ])
365
365
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 )
368
368
# converge of old_sk.pop()
369
369
opt1 = lbfgs .LBFGS (
370
370
learning_rate = 1 ,
@@ -377,7 +377,7 @@ def func2(extream_point, x):
377
377
parameters = net1 .parameters (),
378
378
)
379
379
380
- net2 = Net (extream_point , func2 )
380
+ net2 = Net (extreme_point , func2 )
381
381
# converge of line_search = None
382
382
opt2 = lbfgs .LBFGS (
383
383
learning_rate = 1 ,
@@ -403,8 +403,8 @@ def func2(extream_point, x):
403
403
def test_error (self ):
404
404
# test parameter is not Paddle Tensor
405
405
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 )
408
408
return lbfgs .LBFGS (
409
409
learning_rate = 1 ,
410
410
max_iter = 10 ,
@@ -413,7 +413,7 @@ def error_func1():
413
413
tolerance_change = 1e-09 ,
414
414
history_size = 3 ,
415
415
line_search_fn = 'strong_wolfe' ,
416
- parameters = extream_point ,
416
+ parameters = extreme_point ,
417
417
)
418
418
419
419
self .assertRaises (TypeError , error_func1 )
@@ -429,11 +429,11 @@ def outputs2(x):
429
429
targets = [outputs2 (input )]
430
430
input = paddle .to_tensor (input )
431
431
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 ])
434
434
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 )
437
437
# converge of line_search = None
438
438
opt2 = lbfgs .LBFGS (
439
439
learning_rate = 1 ,
@@ -543,13 +543,13 @@ def func3(x, alpha, d):
543
543
def test_error3 (self ):
544
544
# test parameter shape size <= 0
545
545
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 )
548
548
549
549
def func (w , x ):
550
550
return w * x
551
551
552
- net = Net (extream_point , func )
552
+ net = Net (extreme_point , func )
553
553
net .w = paddle .create_parameter (
554
554
shape = [- 1 , 2 ],
555
555
dtype = net .w .dtype ,
@@ -576,12 +576,12 @@ def error_func4():
576
576
targets = paddle .to_tensor ([inputs * 2 ])
577
577
inputs = paddle .to_tensor (inputs )
578
578
579
- extream_point = np .array ([- 1 , 1 ]).astype ('float32' )
579
+ extreme_point = np .array ([- 1 , 1 ]).astype ('float32' )
580
580
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 ]
583
583
584
- net = Net (extream_point , func )
584
+ net = Net (extreme_point , func )
585
585
opt = lbfgs .LBFGS (
586
586
learning_rate = 1 ,
587
587
max_iter = 10 ,
0 commit comments