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
Copy file name to clipboardExpand all lines: docs/src/backend.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,26 +96,27 @@ nlp = ADNLPModel(f, x0)
96
96
get_adbackend(nlp) # returns the `ADModelBackend` structure that regroup all the various backends.
97
97
```
98
98
99
-
There are currently two ways to modify instantiated backends. The first one is to instantiate a new `ADModelBackend`and use `set_adbackend!` to modify `nlp`.
99
+
To instantiate a new `ADModelBackend`while preserving existing backends, use `set_adbackend`.
The alternative is to use `set_adbackend!` and pass the new backends via `kwargs`. In the second approach, it is possible to pass either the type of the desired backend or an instance as shown below.
107
+
An alternative way to use `set_adbackend` is to pass the new backends as keyword arguments.
108
+
In this approach, you can pass either the type of the desired backend or an existing instance, as shown below.
### Support multiple precision without having to recreate the model
119
+
### Multi-precision model creation with backend reuse
119
120
120
121
One of the strength of `ADNLPModels.jl` is the type flexibility. Let's assume, we first instantiate an `ADNLPModel` with a `Float64` initial guess.
121
122
@@ -133,11 +134,11 @@ x64 = rand(2)
133
134
grad(nlp, x64)
134
135
```
135
136
136
-
It is now possible to move to a different type, for instance `Float32`, while keeping the instance`nlp`.
137
+
It is now possible to move to a different type for the gradient, for instance `Float32`, while keeping the other backends from the original model`nlp`.
0 commit comments