Skip to content

Commit 8b35cfd

Browse files
authored
Add warning to preparation (#253)
1 parent 16d93ef commit 8b35cfd

File tree

8 files changed

+24
-5
lines changed

8 files changed

+24
-5
lines changed

DifferentiationInterface/src/first_order/derivative.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
77
Create an `extras` object subtyping [`DerivativeExtras`](@ref) that can be given to derivative operators.
88
9-
Beware that in the two-argument case, `y` is mutated by `f!` during preparation.
9+
!!! warning
10+
If the function changes in any way, the result of preparation will be invalidated, and you will need to run it again.
11+
In the two-argument case, `y` is mutated by `f!` during preparation.
1012
"""
1113
function prepare_derivative end
1214

DifferentiationInterface/src/first_order/gradient.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
prepare_gradient(f, backend, x) -> extras
55
66
Create an `extras` object subtyping [`GradientExtras`](@ref) that can be given to gradient operators.
7+
8+
!!! warning
9+
If the function changes in any way, the result of preparation will be invalidated, and you will need to run it again.
710
"""
811
function prepare_gradient end
912

DifferentiationInterface/src/first_order/jacobian.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
77
Create an `extras` object subtyping [`JacobianExtras`](@ref) that can be given to Jacobian operators.
88
9-
Beware that in the two-argument case, `y` is mutated by `f!` during preparation.
9+
!!! warning
10+
If the function changes in any way, the result of preparation will be invalidated, and you will need to run it again.
11+
In the two-argument case, `y` is mutated by `f!` during preparation.
1012
"""
1113
function prepare_jacobian end
1214

DifferentiationInterface/src/first_order/pullback.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
77
Create an `extras` object subtyping [`PullbackExtras`](@ref) that can be given to pullback operators.
88
9-
Beware that in the two-argument case, `y` is mutated by `f!` during preparation.
9+
!!! warning
10+
If the function changes in any way, the result of preparation will be invalidated, and you will need to run it again.
11+
In the two-argument case, `y` is mutated by `f!` during preparation.
1012
"""
1113
function prepare_pullback end
1214

DifferentiationInterface/src/first_order/pushforward.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
77
Create an `extras` object subtyping [`PushforwardExtras`](@ref) that can be given to pushforward operators.
88
9-
Beware that in the two-argument case, `y` is mutated by `f!` during preparation.
10-
"""
9+
!!! warning
10+
If the function changes in any way, the result of preparation will be invalidated, and you will need to run it again.
11+
In the two-argument case, `y` is mutated by `f!` during preparation."""
1112
function prepare_pushforward end
1213

1314
"""

DifferentiationInterface/src/second_order/hessian.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
prepare_hessian(f, backend, x) -> extras
55
66
Create an `extras` object subtyping [`HessianExtras`](@ref) that can be given to Hessian operators.
7+
8+
!!! warning
9+
If the function changes in any way, the result of preparation will be invalidated, and you will need to run it again.
710
"""
811
function prepare_hessian end
912

DifferentiationInterface/src/second_order/hvp.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
prepare_hvp(f, backend, x, v) -> extras
55
66
Create an `extras` object subtyping [`HVPExtras`](@ref) that can be given to Hessian-vector product operators.
7+
8+
!!! warning
9+
If the function changes in any way, the result of preparation will be invalidated, and you will need to run it again.
710
"""
811
function prepare_hvp end
912

DifferentiationInterface/src/second_order/second_derivative.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
prepare_second_derivative(f, backend, x) -> extras
55
66
Create an `extras` object subtyping [`SecondDerivativeExtras`](@ref) that can be given to second derivative operators.
7+
8+
!!! warning
9+
If the function changes in any way, the result of preparation will be invalidated, and you will need to run it again.
710
"""
811
function prepare_second_derivative end
912

0 commit comments

Comments
 (0)