test affine graph structure

This commit is contained in:
Mike J Innes 2016-12-15 23:11:35 +00:00
parent 42ce2fadf1
commit 2a4b39054f
2 changed files with 13 additions and 2 deletions

View File

@ -3,3 +3,10 @@ xs = randn(10)' # TODO: batching semantics
d = Affine(10, 20)
@test d(xs) == xs*d.W.x + d.b.x
@testset begin
@capture(syntax(d), x_[1] * W_ + b_)
@test isa(x, Input)
@test isa(W, Param)
@test isa(b, Param)
end

View File

@ -1,5 +1,9 @@
using Flux
using Base.Test
using Flux, DataFlow, MacroTools, Base.Test
using Flux: graph, Param
using DataFlow: Input
syntax(v::Vertex) = prettify(DataFlow.syntax(v))
syntax(x) = syntax(graph(x))
include("basic.jl")
include("recurrent.jl")