Flux.jl/test/basic.jl

25 lines
418 B
Julia
Raw Normal View History

2017-01-24 11:53:42 +00:00
xs = randn(10)
2016-12-15 22:31:39 +00:00
d = Affine(10, 20)
2017-01-30 17:08:45 +00:00
@test d(xs) (xs'*d.W.x + d.b.x)[1,:]
2016-12-15 23:11:35 +00:00
2016-12-15 23:13:20 +00:00
let
2016-12-26 12:19:04 +00:00
@capture(syntax(d), _Frame(_Line(x_[1] * W_ + b_)))
2016-12-15 23:13:20 +00:00
@test isa(x, Input) && isa(W, Param) && isa(b, Param)
2016-12-15 23:11:35 +00:00
end
2017-02-01 12:53:28 +00:00
@net type TLP
first
second
function (x)
l1 = σ(first(x))
l2 = softmax(second(l1))
end
end
let a1 = Affine(10, 20), a2 = Affine(20, 15)
tlp = TLP(a1, a2)
@test tlp(xs) softmax(a2(σ(a1(xs))))
end