-
Notifications
You must be signed in to change notification settings - Fork 26
/
AutoGrad.jl
37 lines (32 loc) · 1.15 KB
/
AutoGrad.jl
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
# __precompile__() # is now the default
module AutoGrad
using LinearAlgebra, Statistics, SpecialFunctions
# To see debug output of AutoGrad internals, set DBGFLAGS to
# non-zero. Each bit of DBGFLAGS can be used to show a subset of dbg
# messages indicated by the `bit` argument to the `dbg` macro.
const DBGFLAGS = 0
macro dbg(bit,x); if (1<<bit) & DBGFLAGS != 0; esc(:(println(_dbg($x)))); end; end;
# To perform profiling of AutoGrad internals, set PROFILING to
# true. Make sure to Pkg.add("TimerOutputs").
const PROFILING = false
if PROFILING
eval(Expr(:using,:TimerOutputs))
macro prof(label,ex); :(@timeit $(esc(label)) $(esc(ex))); end
else
macro prof(label,ex); esc(ex); end
end
export grad, gradloss, getval
export @primitive, @zerograd, @primitive1, @zerograd1, recorder, Rec, Grad # the last three are required for the macros to work
datapath = joinpath(dirname(@__FILE__),"..","data")
include("core.jl")
include("broadcast.jl")
include("macros.jl")
include("base.jl")
include("math.jl")
include("statistics.jl")
include("linearalgebra.jl")
include("specialfunctions.jl")
include("getindex.jl")
include("iterate.jl")
include("cat.jl")
end # module