Flux.jl/test/basic.jl
2017-02-01 18:23:28 +05:30

25 lines
418 B
Julia
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

xs = randn(10)
d = Affine(10, 20)
@test d(xs) (xs'*d.W.x + d.b.x)[1,:]
let
@capture(syntax(d), _Frame(_Line(x_[1] * W_ + b_)))
@test isa(x, Input) && isa(W, Param) && isa(b, Param)
end
@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