You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/10/17 16:45:41 UTC

[GitHub] nswamy closed pull request #12841: Added context object to run TestCharRnn example

nswamy closed pull request #12841: Added context object to run TestCharRnn example
URL: https://github.com/apache/incubator-mxnet/pull/12841
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/scala-package/examples/src/main/scala/org/apache/mxnetexamples/rnn/TestCharRnn.scala b/scala-package/examples/src/main/scala/org/apache/mxnetexamples/rnn/TestCharRnn.scala
index 0fbdf7d918d..25bf479f3f5 100644
--- a/scala-package/examples/src/main/scala/org/apache/mxnetexamples/rnn/TestCharRnn.scala
+++ b/scala-package/examples/src/main/scala/org/apache/mxnetexamples/rnn/TestCharRnn.scala
@@ -123,9 +123,14 @@ class TestCharRnn(CLIParser: CLIParser) extends InferBase {
     val numLstmLayer = 3
     val (_, argParams, _) = Model.loadCheckpoint(CLIParser.modelPrefix, 75)
     this.vocab = Utils.buildVocab(CLIParser.dataPath)
+    var ctx = Context.cpu()
+    if (System.getenv().containsKey("SCALA_TEST_ON_GPU") &&
+      System.getenv("SCALA_TEST_ON_GPU").toInt == 1) {
+      ctx = Context.gpu()
+    }
     val model = new RnnModel.LSTMInferenceModel(numLstmLayer, vocab.size + 1,
       numHidden = numHidden, numEmbed = numEmbed,
-      numLabel = vocab.size + 1, argParams = argParams, dropout = 0.2f)
+      numLabel = vocab.size + 1, argParams = argParams, dropout = 0.2f, ctx = ctx)
     model
   }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services