Skip to content

Commit 7f63ad9

Browse files
committed
More sophisticated testing
1 parent 3d3f551 commit 7f63ad9

17 files changed

Lines changed: 63 additions & 31 deletions

File tree

DifferentiationInterface/ext/DifferentiationInterfaceFastDifferentiationExt/DifferentiationInterfaceFastDifferentiationExt.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ myvec(x::AbstractArray) = vec(x)
2323

2424
variablize(::Number, name::Symbol) = only(make_variables(name))
2525
variablize(x::AbstractArray, name::Symbol) = make_variables(name, size(x)...)
26-
function variablize(x::Union{Tuple,NamedTuple}, name::Symbol)
27-
return map(x) do xi
28-
variablize(xi, gensym()) # TODO: fix symbol?
29-
end
30-
end
3126

3227
function variablize(contexts::NTuple{C,DI.Context}) where {C}
3328
map(enumerate(contexts)) do (k, c)

DifferentiationInterface/src/utils/context.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ The initial values present inside the cache do not matter.
7777
For some backends, preparation allocates the required memory for `Cache` contexts with the right element type, similar to [PreallocationTools.jl](https://github.com/SciML/PreallocationTools.jl).
7878
7979
!!! warning
80-
Some backends require any `Cache` context to be an `AbstractArray or a (named) tuple of `AbstractArray`s.
80+
Some backends require any `Cache` context to be an `AbstractArray`, others accept nested (named) tuples of `AbstractArray`s.
8181
8282
# Example
8383

DifferentiationInterface/test/Back/Enzyme/test.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ end;
5555

5656
test_differentiation(
5757
backends[2],
58-
default_scenarios(; include_normal=false, include_cachified=true);
58+
default_scenarios(; include_normal=false, include_cachified=true, use_tuples=true);
5959
excluded=SECOND_ORDER,
6060
logging=LOGGING,
6161
)

DifferentiationInterface/test/Back/FiniteDiff/test.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ end
2222
@testset "Dense" begin
2323
test_differentiation(
2424
AutoFiniteDiff(),
25-
default_scenarios(; include_constantified=true, include_cachified=true);
25+
default_scenarios(;
26+
include_constantified=true, include_cachified=true, use_tuples=true
27+
);
2628
excluded=[:second_derivative, :hvp],
2729
logging=LOGGING,
2830
)

DifferentiationInterface/test/Back/FiniteDifferences/test.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ end
1919

2020
test_differentiation(
2121
AutoFiniteDifferences(; fdm=FiniteDifferences.central_fdm(3, 1)),
22-
default_scenarios(; include_constantified=true, include_cachified=true);
22+
default_scenarios(;
23+
include_constantified=true, include_cachified=true, use_tuples=true
24+
);
2325
excluded=SECOND_ORDER,
2426
logging=LOGGING,
2527
);

DifferentiationInterface/test/Back/ForwardDiff/test.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ end
3636
test_differentiation(
3737
AutoForwardDiff(),
3838
default_scenarios(;
39-
include_normal=false, include_batchified=false, include_cachified=true
39+
include_normal=false,
40+
include_batchified=false,
41+
include_cachified=true,
42+
use_tuples=true,
4043
);
4144
logging=LOGGING,
4245
)

DifferentiationInterface/test/Back/Mooncake/test.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ end
1919

2020
test_differentiation(
2121
backends,
22-
default_scenarios(; include_constantified=true, include_cachified=true);
22+
default_scenarios(;
23+
include_constantified=true, include_cachified=true, use_tuples=true
24+
);
2325
excluded=SECOND_ORDER,
2426
logging=LOGGING,
2527
);

DifferentiationInterface/test/Back/PolyesterForwardDiff/test.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ end
2828

2929
test_differentiation(
3030
backends,
31-
default_scenarios(; include_constantified=true, include_cachified=true);
31+
default_scenarios(;
32+
include_constantified=true, include_cachified=true, use_tuples=true
33+
);
3234
logging=LOGGING,
3335
);
3436

DifferentiationInterface/test/Back/SymbolicBackends/fastdifferentiation.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ end
1717

1818
test_differentiation(
1919
AutoFastDifferentiation(),
20-
default_scenarios(; include_constantified=true, include_cachified=true);
20+
default_scenarios(;
21+
include_constantified=true, include_cachified=true, use_tuples=false
22+
);
2123
logging=LOGGING,
2224
);
2325

DifferentiationInterface/test/Back/SymbolicBackends/symbolics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test_differentiation(
2121

2222
test_differentiation(
2323
AutoSymbolics(),
24-
default_scenarios(; include_normal=false, include_cachified=true);
24+
default_scenarios(; include_normal=false, include_cachified=true, use_tuples=false);
2525
excluded=[:jacobian], # TODO: figure out why this fails
2626
logging=LOGGING,
2727
);

0 commit comments

Comments
 (0)