Flux.jl/test/backend.jl

33 lines
495 B
Julia
Raw Normal View History

2017-01-25 12:40:56 +00:00
xs = rand(20)
2017-01-25 11:33:58 +00:00
d = Affine(20, 10)
2017-02-20 20:09:05 +00:00
# MXNet
2017-01-26 18:32:59 +00:00
2017-02-21 12:58:31 +00:00
@mxonly let dm = mxnet(d, (20, 1))
2017-01-30 18:05:15 +00:00
@test d(xs) dm(xs)
2017-01-30 17:33:15 +00:00
end
2017-02-20 20:09:05 +00:00
@mxonly let
using MXNet
f = mx.FeedForward(Chain(d, softmax))
@test isa(f, mx.FeedForward)
# TODO: test run
end
# TensorFlow
@tfonly let dt = tf(d)
@test d(xs) dt(xs)
end
2017-01-26 18:32:59 +00:00
2017-02-01 07:11:17 +00:00
@tfonly let
using TensorFlow
2017-01-26 18:32:59 +00:00
sess = TensorFlow.Session()
X = placeholder(Float32)
Y = Tensor(d, X)
run(sess, initialize_all_variables())
2017-01-25 11:33:58 +00:00
2017-01-26 18:32:59 +00:00
@test run(sess, Y, Dict(X=>xs')) d(xs)'
end