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
/// Defines a derivative for `OrderedDictionary`s subscript getter enabling calls like `var value = dictionary[key]` to be differentiable
32
+
/// Defines a derivative for `OrderedDictionary`s subscript getter enabling calls like `var value = dictionary[key]` to be
33
+
/// differentiable
33
34
@inlinable
34
35
@derivative(of:subscript(_:))
35
36
func _vjpSubscript(key:Key)
@@ -38,7 +39,8 @@ extension OrderedDictionary where Value: Differentiable {
38
39
letkeys=self.keys
39
40
// When adding two dictionaries, nil values are equivalent to zeroes, so there is no need to manually zero-out
40
41
// every key's value. Instead, it is faster to create a dictionary with the single non-zero entry.
41
-
// for ordered dictionaries however we can't because the keys will be added in reverse order so the tangentvector's key order will be different from the original
42
+
// for ordered dictionaries however we can't because the keys will be added in reverse order so the tangentvector's key order will
43
+
// be different from the original
42
44
return(
43
45
value:self[key],
44
46
pullback:{ tangentVector in
@@ -61,4 +63,3 @@ extension OrderedDictionary where Value: Differentiable {
61
63
// TODO: make `OrderedDictionary.Values` and `OrderedDictionary.Elements` differentiable
0 commit comments