-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathweird.jl
More file actions
95 lines (81 loc) · 2.04 KB
/
weird.jl
File metadata and controls
95 lines (81 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using Pkg
Pkg.add(["FiniteDiff", "Lux", "LuxTestUtils"])
using ADTypes
using ComponentArrays: ComponentArrays
using DifferentiationInterface
using DifferentiationInterfaceTest
import DifferentiationInterfaceTest as DIT
using FiniteDifferences: FiniteDifferences
using ForwardDiff: ForwardDiff
using Flux: Flux
using ForwardDiff: ForwardDiff
using JLArrays: JLArrays
using Lux: Lux
using LuxTestUtils: LuxTestUtils
using Random
using SparseConnectivityTracer
using SparseMatrixColorings
using StaticArrays: StaticArrays
using Zygote: Zygote
LOGGING = get(ENV, "CI", "false") == "false"
## Generate all scenarios
gpu_scenarios(;
include_constantified=true,
include_closurified=true,
include_batchified=true,
include_cachified=true,
use_tuples=true,
)
static_scenarios(;
include_constantified=true,
include_closurified=true,
include_batchified=true,
include_cachified=true,
use_tuples=true,
)
## Weird arrays
test_differentiation(
AutoForwardDiff(),
DIT.no_matrices(static_scenarios());
benchmark=:prepared,
logging=LOGGING,
)
test_differentiation(AutoForwardDiff(), component_scenarios(); logging=LOGGING)
test_differentiation(AutoZygote(), gpu_scenarios(); excluded=SECOND_ORDER, logging=LOGGING)
## Closures & caches
test_differentiation(
AutoFiniteDiff(),
default_scenarios(;
include_normal=false,
include_closurified=true,
include_cachified=true,
use_tuples=true,
);
excluded=SECOND_ORDER,
logging=LOGGING,
);
test_differentiation(
AutoFiniteDiff(),
unknown_activity(default_scenarios);
excluded=SECOND_ORDER,
logging=LOGGING,
);
## Neural nets
test_differentiation(
AutoZygote(),
DIT.flux_scenarios(Random.MersenneTwister(0));
isapprox=DIT.flux_isapprox,
rtol=1e-2,
atol=1e-4,
scenario_intact=false,
logging=LOGGING,
)
test_differentiation(
AutoZygote(),
DIT.lux_scenarios(Random.Xoshiro(63));
isapprox=DIT.lux_isapprox,
rtol=1.0f-2,
atol=1.0f-3,
scenario_intact=false,
logging=LOGGING,
)