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: DifferentiationInterface/src/misc/from_primitive.jl
+13-9Lines changed: 13 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -12,17 +12,21 @@ function pick_batchsize(backend::FromPrimitive, N::Integer)
12
12
end
13
13
14
14
"""
15
-
AutoForwardFromPrimitive
15
+
AutoForwardFromPrimitive(backend::AbstractADType)
16
16
17
-
Wrapper which forces a given backend to act as a reverse-mode backend.
17
+
Wrapper which forces a given backend to act as a forward-mode backend, using only its native `value_and_pushforward` primitive and re-implementing the rest from scratch.
18
18
19
-
Used in internal testing.
19
+
!!! tip
20
+
This can be useful to circumvent high-level operators when they have impractical limitations.
21
+
For instance, ForwardDiff.jl's `jacobian` does not support GPU arrays but its `pushforward` does, so `AutoForwardFromPrimitive(AutoForwardDiff())` has a GPU-friendly `jacobian`.
@@ -133,17 +137,17 @@ function value_and_pushforward!(
133
137
end
134
138
135
139
"""
136
-
AutoReverseFromPrimitive
140
+
AutoReverseFromPrimitive(backend::AbstractADType)
137
141
138
-
Wrapper which forces a given backend to act as a reverse-mode backend.
139
-
140
-
Used in internal testing.
142
+
Wrapper which forces a given backend to act as a reverse-mode backend, using only its native `value_and_pullback` implementation and rebuilding the rest from scratch.
0 commit comments