diff --git a/README.md b/README.md index 9c8c4f74..b23abd09 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # Flux -[![Build Status](https://travis-ci.org/one-more-minute/Flux.jl.svg?branch=master)](https://travis-ci.org/one-more-minute/Flux.jl) +Flux is an experimental machine perception / ANN library for Julia. diff --git a/examples/sketch.jl b/examples/sketch.jl new file mode 100644 index 00000000..4e9949fa --- /dev/null +++ b/examples/sketch.jl @@ -0,0 +1,57 @@ +# Simple Perceptron Layer + +@flux type Simple + weight + bias + feed(x) = σ( weight*x + bias ) +end + +Simple(nx::Integer, ny::Integer; init = randn) = + Simple(init(nx, ny), init(ny)) + +# Time Delay Node + +type Delay + n::Int + next +end + +# feed(l::Delay, x) = ... + +# back(l::Delay, y) = ... + +# Simple Recurrent + +@flux type RecurrentU + Wxh; Whh; Bh + Wxy; Why; By + + function feed(x, hidden) + hidden′ = σ( Wxh*x + Whh*hidden + Bh ) + y = σ( Wxy*x + Why*hidden′ + By ) + y, hidden′ + end +end + +Recurrent(nx, ny, nh; init = randn) = + Recurrent(init(nx, nh), init(nh, nh), init(nh), + init(nx, ny), init(nh, ny), init(ny)) + +@flux type Looped{T} + delay::Delay + layer::T + + function feed(x) + y, hidden = layer(x, delay(hidden)) + return y + end +end + +type Recurrent + layer::Looped{RecurrentU} +end + +Recurrent(nx, ny, nh; init = randn, delay = 10) = + Looped(Delay(delay, init(nh)), RecurrentU(nx, ny, nh)) + +@forward Recurrent.layer feed diff --git a/src/Flux.jl b/src/Flux.jl index fd37304e..4e284dd2 100644 --- a/src/Flux.jl +++ b/src/Flux.jl @@ -2,4 +2,9 @@ module Flux # Zero Flux Given +abstract Capacitor + +macro flux(x) +end + end # module