@@ -55,14 +55,6 @@ public class RMSProp<Model: Differentiable>: Optimizer
55
55
}
56
56
57
57
public func update( _ model: inout Model , along direction: Model . TangentVector ) {
58
- update ( & model. allDifferentiableVariables, along: direction)
59
- }
60
-
61
- // TODO: Deprecate this when `Differentiable.AllDifferentiableVariables` is removed.
62
- public func update(
63
- _ model: inout Model . AllDifferentiableVariables ,
64
- along direction: Model . TangentVector
65
- ) {
66
58
step += 1
67
59
let learningRate = self . learningRate * 1 / ( 1 + decay * Float( step) )
68
60
alpha = alpha * rho + direction .* direction * ( 1 - rho)
@@ -107,14 +99,6 @@ public class AdaGrad<Model: Differentiable>: Optimizer
107
99
}
108
100
109
101
public func update( _ model: inout Model , along direction: Model . TangentVector ) {
110
- update ( & model. allDifferentiableVariables, along: direction)
111
- }
112
-
113
- // TODO: Deprecate this when `Differentiable.AllDifferentiableVariables` is removed.
114
- public func update(
115
- _ model: inout Model . AllDifferentiableVariables ,
116
- along direction: Model . TangentVector
117
- ) {
118
102
alpha = rho + direction .* direction
119
103
let denominator = Model . TangentVector. sqrt ( alpha) + epsilon
120
104
model. move ( along: - learningRate * direction ./ denominator)
@@ -166,14 +150,6 @@ public class AdaDelta<Model: Differentiable>: Optimizer
166
150
}
167
151
168
152
public func update( _ model: inout Model , along direction: Model . TangentVector ) {
169
- update ( & model. allDifferentiableVariables, along: direction)
170
- }
171
-
172
- // TODO: Deprecate this when `Differentiable.AllDifferentiableVariables` is removed.
173
- public func update(
174
- _ model: inout Model . AllDifferentiableVariables ,
175
- along direction: Model . TangentVector
176
- ) {
177
153
step += 1
178
154
let learningRate = self . learningRate / ( 1 + decay * Float( step) )
179
155
averageSquared = rho * averageSquared + ( 1 - rho) * direction .* direction
@@ -230,15 +206,7 @@ public class Adam<Model: Differentiable>: Optimizer
230
206
}
231
207
232
208
public func update( _ model: inout Model , along direction: Model . TangentVector ) {
233
- update ( & model. allDifferentiableVariables, along: direction)
234
- }
235
-
236
- // TODO: Deprecate this when `Differentiable.AllDifferentiableVariables` is removed.
237
- public func update(
238
- _ model: inout Model . AllDifferentiableVariables ,
239
- along direction: Model . TangentVector
240
- ) {
241
- self . step += 1
209
+ step += 1
242
210
let step = Float ( self . step)
243
211
let learningRate = self . learningRate * 1 / ( 1 + decay * step)
244
212
// Note: `stepSize` and `secondMoments` are split into two lines to avoid the "compiler is
@@ -304,15 +272,7 @@ public class AdaMax<Model: Differentiable & KeyPathIterable>: Optimizer
304
272
}
305
273
306
274
public func update( _ model: inout Model , along direction: Model . TangentVector ) {
307
- update ( & model. allDifferentiableVariables, along: direction)
308
- }
309
-
310
- // TODO: Deprecate this when `Differentiable.AllDifferentiableVariables` is removed.
311
- public func update(
312
- _ model: inout Model . AllDifferentiableVariables ,
313
- along direction: Model . TangentVector
314
- ) {
315
- self . step += 1
275
+ step += 1
316
276
let step = Float ( self . step)
317
277
let learningRate = self . learningRate * 1 / ( 1 + decay * step)
318
278
// Note: `stepSize` is split into two lines to avoid the "compiler is unable to type-check
@@ -390,15 +350,7 @@ public class AMSGrad<Model: Differentiable & KeyPathIterable>: Optimizer
390
350
}
391
351
392
352
public func update( _ model: inout Model , along direction: Model . TangentVector ) {
393
- update ( & model. allDifferentiableVariables, along: direction)
394
- }
395
-
396
- // TODO: Deprecate this when `Differentiable.AllDifferentiableVariables` is removed.
397
- public func update(
398
- _ model: inout Model . AllDifferentiableVariables ,
399
- along direction: Model . TangentVector
400
- ) {
401
- self . step += 1
353
+ step += 1
402
354
let step = Float ( self . step)
403
355
let beta1Power = pow ( beta1, step)
404
356
let beta2Power = pow ( beta2, step)
0 commit comments