Flux.jl/examples/MNIST.jl

19 lines
364 B
Julia
Raw Normal View History

2016-08-25 21:49:21 +00:00
using Flux, MNIST
2016-04-01 21:11:42 +00:00
2016-08-25 16:26:52 +00:00
@time begin
const data = [(trainfeatures(i), onehot(trainlabel(i), 0:9)) for i = 1:60_000]
const train = data[1:50_000]
const test = data[50_001:60_000]
nothing
end
2016-04-01 21:11:42 +00:00
2016-08-25 16:26:52 +00:00
m = Chain(
2016-04-01 21:11:42 +00:00
Input(784),
2016-08-25 21:49:21 +00:00
Dense(128), relu,
Dense( 64), relu,
Dense( 10), softmax)
2016-04-01 21:11:42 +00:00
2016-08-25 16:26:52 +00:00
model = mxnet(m, 784)
@time Flux.train!(model, train, test, epoch = 1, η=0.001)