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
@differentiable(default) // Inherits default derivative for `P.foo(_:)`.
1812
+
funcfoo(_x: Float) ->Float {
1813
+
33
1814
+
}
1815
+
}
1816
+
1817
+
let s =S()
1818
+
let d =derivative(at: 0) { x in
1819
+
s.foo(x)
1820
+
} // ==> 42
1821
+
```
1822
+
1753
1823
### Differentiable function types
1754
1824
1755
1825
Differentiability is a fundamental mathematical concept that applies not only to
@@ -2241,13 +2311,13 @@ whether the derivative is always zero and warns the user.
2241
2311
2242
2312
```swift
2243
2313
let grad =gradient(at: 1.0) { x in
2244
-
3.squareRoot()
2314
+
Double(3).squareRoot()
2245
2315
}
2246
2316
```
2247
2317
2248
2318
```console
2249
-
test.swift:4:18: warning: result does not depend on differentiation arguments and will always have a zero derivative; do you want to add '.withoutDerivative()' to make it explicit?
2250
-
3.squareRoot()
2319
+
test.swift:4:18: warning: result does not depend on differentiation arguments and will always have a zero derivative; do you want to use 'withoutDerivative(at:)' to make it explicit?
0 commit comments