Skip to content

Instantly share code, notes, and snippets.

@jfsantos
Created March 31, 2015 20:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfsantos/ca147bef179a23911bd3 to your computer and use it in GitHub Desktop.
Save jfsantos/ca147bef179a23911bd3 to your computer and use it in GitHub Desktop.
ENV["MOCHA_USE_CUDA"] = "true"
using HDF5, JLD, Mocha
X = Array[]
push!(X, rand(Float32, 128,11*129,1,1))
y = Array[]
push!(y, rand(Float32, 128, 129, 1, 1))
#data_layer = AsyncHDF5DataLayer("train", "train.txt", 128, 1000, [:features, :targets], false, [])
data_layer = MemoryDataLayer(tops=[:features, :targets], data=[X, y], batch_size=1)
fc1_layer = InnerProductLayer(name="ip1", output_dim=2048, neuron=Neurons.ReLU(), weight_regu=L2Regu(0.00005), bottoms=[:features], tops=[:ip1])
fc2_layer = InnerProductLayer(name="ip2", output_dim=2048, neuron=Neurons.ReLU(), weight_regu=L2Regu(0.00005), bottoms=[:ip1], tops=[:ip2])
fc3_layer = InnerProductLayer(name="ip3", output_dim=2048, neuron=Neurons.ReLU(), weight_regu=L2Regu(0.00005), bottoms=[:ip2], tops=[:ip3])
fc4_layer = InnerProductLayer(name="ip4", output_dim=129, neuron=Neurons.Identity(), weight_regu=L2Regu(0.00005), bottoms=[:ip3], tops=[:ip4])
sys = GPUBackend()
init(sys)
common_layers = [fc1_layer, fc2_layer, fc3_layer, fc4_layer]
net = Net("GT-Eval", sys, [data_layer, common_layers...])
load_network(jldopen("snapshots/snapshot-020000.jld"), net)
Y = zeros(129,1,1,10)
for k=1:10
forward(net)
Y[:,:,:,k] = net.states[end].blobs[end].data[:]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment