How can I run MNIST on OptiML?

65 views
Skip to first unread message

Jeongseob Ahn

unread,
Jul 1, 2015, 1:34:51 PM7/1/15
to opt...@googlegroups.com
Hi all,

I am trying to run MNIST on OptiML. Although there is an instruction(http://stanford-ppl.github.io/Delite/optiml/neural_network.html) in the OptiML website, I cannot find any related source or script files. 

Thanks,
Jeongseob

Qi Qi

unread,
Nov 7, 2015, 10:53:49 AM11/7/15
to OptiML
I would like to ask the same question. 

Arvind Sujeeth

unread,
Nov 10, 2015, 1:35:22 AM11/10/15
to opt...@googlegroups.com
Hi,

You can find the related source code on one of the development branches: https://github.com/stanford-ppl/Forge/tree/wip-master/apps/OptiML/src/NeuralNetwork. Unfortunately, I am not sure if it has been maintained or if the example still works as described in the instructions. At least it provides a reference, though.

Hope this helps,
Arvind
--
You received this message because you are subscribed to the Google Groups "OptiML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to optiml+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Qi Qi

unread,
Nov 11, 2015, 10:06:59 AM11/11/15
to OptiML
Thanks for the pointer. The neural-network instructions seemed working until typing sbt compile, it  gave the following error messages. 

Is there a quick fix to this?

[info] Loading project definition from /Users/qiqi/Workstation/hyperdsl/published/OptiML/project

[info] Set current project to OptiML (in build file:/Users/qiqi/Workstation/hyperdsl/published/OptiML/)

[info] Compiling 7 Scala sources to /Users/qiqi/Workstation/hyperdsl/published/OptiML/apps/target/scala-2.10/classes...

[error] /Users/qiqi/Workstation/hyperdsl/published/OptiML/apps/src/NeuralNetwork/mnist_tutorial/mnist_tutorial.scala:36: type mismatch;

[error]  found   : X.type (with underlying type mnist_tutorial.this.Rep[mnist_tutorial.this.DenseMatrix[Double]])

[error]  required: mnist_tutorial.this.Rep[mnist_tutorial.this.DenseMatrix[Float]]

[error] val o0 = (conv_fw (X, 1, w0, b0, 6, 25, 5, 2, 784, 28)).map(ReLU)

[error                   ^

[error] /Users/qiqi/Workstation/hyperdsl/published/OptiML/apps/src/NeuralNetwork/mnist_tutorial/mnist_tutorial.scala:42: type mismatch;

[error]  found   : w2.type (with underlying type mnist_tutorial.this.Rep[mnist_tutorial.this.DenseMatrix[Double]])

[error]  required: mnist_tutorial.this.Rep[mnist_tutorial.this.DenseMatrix[Float]]

[error] val o2 = (conv_fw (o1, 6, w2, b2, 6, 25, 5, 2, 196, 14)).map(ReLU)

[error]                           ^

[error] /Users/qiqi/Workstation/hyperdsl/published/OptiML/apps/src/NeuralNetwork/mnist_tutorial/mnist_tutorial.scala:48: type mismatch;

[error]  found   : w4.type (with underlying type mnist_tutorial.this.Rep[mnist_tutorial.this.DenseMatrix[Double]])

[error]  required: mnist_tutorial.this.Rep[mnist_tutorial.this.DenseMatrix[Float]]

[error] val o4 = (fullycon_fw (o3, w4, b4)).map(ReLU)

[error                           ^

[error] /Users/qiqi/Workstation/hyperdsl/published/OptiML/apps/src/NeuralNetwork/mnist_tutorial/mnist_tutorial.scala:51: type mismatch;

[error]  found   : w5.type (with underlying type mnist_tutorial.this.Rep[mnist_tutorial.this.DenseMatrix[Double]])

[error]  required: mnist_tutorial.this.Rep[mnist_tutorial.this.DenseMatrix[Float]]

[error] val o5 = (softmax_fw (o4, w5, b5))

[error]                           ^

[error] /Users/qiqi/Workstation/hyperdsl/published/OptiML/apps/src/NeuralNetwork/mnist_tutorial/mnist_tutorial.scala:633: type mismatch;

[error]  found   : mnist_tutorial.this.Var[Double]

[error]  required: ?{def +: ?}

[error] Note that implicit conversions are not applicable because they are ambiguous:

[error]  both method any2stringadd in object Predef of type [Suppressed for performance reasons (SI-6149). Compile with -DshowSuppressedErrors=true to show].

[error]  and method infixNumericOps in trait ExtraImplicits of type [Suppressed for performance reasons (SI-6149). Compile with -DshowSuppressedErrors=true to show].

[error]  are possible conversion functions from mnist_tutorial.this.Var[Double] to ?{def +: ?}

[error] classification_error += get_classification_error(o5, y.slice(idx*minib_size, (idx+1)*minib_size))

[error] ^

[error] /Users/qiqi/Workstation/hyperdsl/published/OptiML/apps/src/NeuralNetwork/mnist_tutorial/mnist_tutorial.scala:223: Any does not take parameters

[error val prob = o5(i,j)

[error]               ^

[error] 6 errors found

[error] (OptiML-apps/compile:compile) Compilation failed

Arvind Sujeeth

unread,
Nov 11, 2015, 11:34:23 AM11/11/15
to opt...@googlegroups.com
The errors are all type errors that may have been caused by changes in OptiML since the instructions were written.

I would start with the first few which seem simple: the app is expecting DenseMatrix[Float], but getting DenseMatrix[Double]. Without having looked at the generated app, I can't tell you exactly what to change, but normally you can fix this by either changing type signatures to be consistent, or replacing constants like "0.0" (double) with "0f" (float).

Arvind
Reply all
Reply to author
Forward
0 new messages