2017-01-25 12:40:56 +00:00
|
|
|
xs = rand(20)
|
2017-01-25 11:33:58 +00:00
|
|
|
d = Affine(20, 10)
|
|
|
|
|
2017-01-26 18:32:59 +00:00
|
|
|
let dt = tf(d)
|
|
|
|
@test d(xs) ≈ dt(xs)
|
|
|
|
end
|
|
|
|
|
2017-01-30 17:33:15 +00:00
|
|
|
# TODO: batch semantics
|
|
|
|
let dm = mxnet(d, (1, 20))
|
|
|
|
@test d(xs)' ≈ dm(xs')
|
|
|
|
end
|
|
|
|
|
2017-01-26 18:32:59 +00:00
|
|
|
# TensorFlow native integration
|
|
|
|
|
|
|
|
using TensorFlow
|
|
|
|
|
|
|
|
let
|
|
|
|
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
|