Skip to content

Instantly share code, notes, and snippets.

@lefant
Last active August 29, 2015 14:17
Show Gist options
  • Save lefant/48f322e3b106e90ce507 to your computer and use it in GitHub Desktop.
Save lefant/48f322e3b106e90ce507 to your computer and use it in GitHub Desktop.
patch Mocha.jl mnist.jl example to use cpu backend
index dd2a40f..98458e3 100644
--- a/examples/mnist/mnist.jl
+++ b/examples/mnist/mnist.jl
@@ -1,7 +1,7 @@
#ENV["MOCHA_USE_NATIVE_EXT"] = "true"
#ENV["OMP_NUM_THREADS"] = 1
#blas_set_num_threads(1)
-ENV["MOCHA_USE_CUDA"] = "true"
+#ENV["MOCHA_USE_CUDA"] = "true"
using Mocha
srand(12345678)
@@ -15,7 +15,7 @@ fc1_layer = InnerProductLayer(name="ip1", output_dim=500, neuron=Neurons.ReLU(
fc2_layer = InnerProductLayer(name="ip2", output_dim=10, bottoms=[:ip1], tops=[:ip2])
loss_layer = SoftmaxLossLayer(name="loss", bottoms=[:ip2,:label])
-backend = GPUBackend()
+backend = CPUBackend()
init(backend)
common_layers = [conv_layer, pool_layer, conv2_layer, pool2_layer, fc1_layer, fc2_layer]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment