blob: 7bc9c5d1ff94a6fd5c2defdc639b99667db6ef0e (
plain)
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
|
module NeuralNetworks
struct Linear
W::Matrix{Float64}
b::Vector{Float64}
end
function (l::Linear)(x::Vector{Float64})
end
struct Activation
end
struct MLP
end
struct AffineCoupling
end
function (f::AffineCoupling)(x::Vector{Float64})::Float64
return 0.
end
struct RealNVP
layers::Vector{AffineCoupling}
function RealNVP()
layers = Vector{AffineCoupling}()
new(layers)
end
end
function (f::RealNVP)(x::Vector{Float64})::Float64
ldJ::Float64 = 0.
for l! in f.layers
ldJ += l!(x)
end
return ldJ
end
end
|