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
Create a `prep` object that can be given to [`$(operator)`](@ref) and its variants to speed them up$(samepoint_warning(samepoint)).
20
+
21
+
Depending on the backend, this can have several effects (preallocating memory, recording an execution trace) which are transparent to the user.
22
+
23
+
!!! warning
24
+
The preparation result is only reusable as long as the arguments to `$operator` do not change type or size, and the function and backend themselves are not modified.
25
+
Otherwise, preparation will be invalidated and you will need to run it again.
26
+
$(inplace ?"\nFor in-place functions, `y` is mutated by `f!` during preparation.":"")
27
+
"""
28
+
end
29
+
30
+
functiondocstring_prepare!(operator)
31
+
return"""
32
+
Same behavior as [`prepare_$(operator)`](@ref) but can resize the contents of an existing `prep` object to avoid some allocations.
33
+
34
+
There is no guarantee that `prep` will be mutated, or that performance will be improved compared to preparation from scratch.
35
+
36
+
!!! danger
37
+
Compared to when `prep` was first created, the only authorized modification is a size change for input `x` or output `y`.
38
+
Any other modification (like a change of type for the input) is not supported and will give erroneous results.
39
+
40
+
!!! danger
41
+
For efficiency, this function needs to rely on backend package internals, therefore it not protected by semantic versioning.
Copy file name to clipboardExpand all lines: DifferentiationInterface/src/first_order/mixed_mode.jl
+18-2Lines changed: 18 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
"""
2
2
MixedMode
3
3
4
-
Combination of a forward and a reverse mode backend for mixed-mode Jacobian computation.
4
+
Combination of a forward and a reverse mode backend for mixed-mode sparse Jacobian computation.
5
5
6
6
!!! danger
7
-
`MixedMode` backends only support [`jacobian`](@ref) and its variants.
7
+
`MixedMode` backends only support [`jacobian`](@ref) and its variants, and it should be used inside an [`AutoSparse`](@extref ADTypes.AutoSparse) wrapper.
prepare_pullback_same_point(f!, y, backend, x, ty, [contexts...]) -> prep_same
31
22
32
-
Create an `prep_same` object that can be given to [`pullback`](@ref) and its variants _if they are applied at the same point `x` and with the same `contexts`_.
33
-
34
-
!!! warning
35
-
If the function or the point changes in any way, the result of preparation will be invalidated, and you will need to run it again.
36
-
For in-place functions, `y` is mutated by `f!` during preparation.
0 commit comments