lanking520 commented on a change in pull request #13995: [MXNET-1287] Scala
compiler warnings
URL: https://github.com/apache/incubator-mxnet/pull/13995#discussion_r271965861
##########
File path:
scala-package/examples/src/test/scala/org/apache/mxnetexamples/rnn/ExampleRNNSuite.scala
##########
@@ -43,37 +44,43 @@ class ExampleRNNSuite extends FunSuite with
BeforeAndAfterAll {
}
test("Example CI: Test LSTM Bucketing") {
- val tempDirPath = System.getProperty("java.io.tmpdir")
- var ctx = Context.cpu()
- if (System.getenv().containsKey("SCALA_TEST_ON_GPU") &&
- System.getenv("SCALA_TEST_ON_GPU").toInt == 1) {
- ctx = Context.gpu()
- }
- if (!System.getenv().containsKey("CI")) {
- LstmBucketing.runTraining(tempDirPath + "/RNN/sherlockholmes.train.txt",
- tempDirPath + "/RNN/sherlockholmes.valid.txt",
Array(ctx), 1)
- } else {
- logger.info("Skipping test on CI...")
+ ResourceScope.using() {
+ val tempDirPath = System.getProperty("java.io.tmpdir")
+ var ctx = Context.cpu()
+ if (System.getenv().containsKey("SCALA_TEST_ON_GPU") &&
+ System.getenv("SCALA_TEST_ON_GPU").toInt == 1) {
+ ctx = Context.gpu()
+ }
+ if (!System.getenv().containsKey("CI")) {
+ LstmBucketing.runTraining(tempDirPath +
"/RNN/sherlockholmes.train.txt",
+ tempDirPath +
"/RNN/sherlockholmes.valid.txt", Array(ctx), 1)
+ } else {
+ logger.info("Skipping test on CI...")
+ }
}
}
test("Example CI: Test TrainCharRNN") {
- val tempDirPath = System.getProperty("java.io.tmpdir")
- if (System.getenv().containsKey("SCALA_TEST_ON_GPU") &&
- System.getenv("SCALA_TEST_ON_GPU").toInt == 1 &&
- !System.getenv().containsKey("CI")) {
- val ctx = Context.gpu()
- TrainCharRnn.runTrainCharRnn(tempDirPath + "/RNN/obama.txt",
- tempDirPath, ctx, 1)
- } else {
- logger.info("CPU not supported for this test, skipped...")
+ ResourceScope.using() {
Review comment:
Actually, memory collection happened in the method. You should change that
one as well
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services