You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 30, 2022. It is now read-only.
Copy file name to clipboardexpand all lines: docs/ParameterOptimization.md
+20-20
Original file line number
Diff line number
Diff line change
@@ -35,30 +35,30 @@ Here are some additional rules about models and parameters:
35
35
36
36
1. Not all properties of a model are required to be parameters: a model may have properties which aren't meant to be trainable (e.g. configuration flags or state-caching variables). This requires a clear way to distinguish parameters from other properties.
37
37
38
-
```swift
39
-
structMyMLModel {
40
-
// These are parameters.
41
-
var weight: Tensor<Float>
42
-
var bias: Tensor<Float>
43
-
44
-
// Need to distinguish from non-parameter stored properties.
45
-
let useBias: Bool
46
-
var previousWeight: Tensor<Float>
47
-
}
48
-
```
38
+
```swift
39
+
structMyMLModel {
40
+
// These are parameters.
41
+
var weight: Tensor<Float>
42
+
var bias: Tensor<Float>
43
+
44
+
// Need to distinguish from non-parameter stored properties.
45
+
let useBias: Bool
46
+
var previousWeight: Tensor<Float>
47
+
}
48
+
```
49
49
50
50
2. There must exist some mechanism to update all parameters of a model given their gradients.
51
51
52
-
The ability to jointly iterate over parameters and gradients is crucial for writing simple, generic code that works with all models. Without this ability to perform "generic parameter update", users must duplicate code for each parameter, with no potential for generalization:
52
+
The ability to jointly iterate over parameters and gradients is crucial for writing simple, generic code that works with all models. Without this ability to perform "generic parameter update", users must duplicate code foreach parameter, with no potential for generalization:
0 commit comments