You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by ns...@apache.org on 2018/06/29 11:57:34 UTC

[incubator-mxnet] branch master updated: [MXNET-564] Fix the Flaky test on arange (#11377)

This is an automated email from the ASF dual-hosted git repository.

nswamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new c84a2f6  [MXNET-564] Fix the Flaky test on arange (#11377)
c84a2f6 is described below

commit c84a2f66eb73b743133bb80d008eef098a264172
Author: Lanking <la...@live.com>
AuthorDate: Fri Jun 29 04:57:28 2018 -0700

    [MXNET-564] Fix the Flaky test on arange (#11377)
    
    * Fix Flaky Test - Change float to double to increase the precision of numbers generated in scala
---
 .../core/src/test/scala/org/apache/mxnet/OperatorSuite.scala     | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scala-package/core/src/test/scala/org/apache/mxnet/OperatorSuite.scala b/scala-package/core/src/test/scala/org/apache/mxnet/OperatorSuite.scala
index 5531933..dd5f96f 100644
--- a/scala-package/core/src/test/scala/org/apache/mxnet/OperatorSuite.scala
+++ b/scala-package/core/src/test/scala/org/apache/mxnet/OperatorSuite.scala
@@ -18,12 +18,12 @@
 package org.apache.mxnet
 
 import org.apache.mxnet.CheckUtils._
-
 import org.scalatest.prop.GeneratorDrivenPropertyChecks
-import org.scalatest.{Matchers, BeforeAndAfterAll, FunSuite}
+import org.scalatest.{BeforeAndAfterAll, FunSuite, Matchers}
 import org.scalacheck.Gen
 
 import scala.collection.mutable
+import scala.collection.mutable.ArrayBuffer
 
 class OperatorSuite extends FunSuite with BeforeAndAfterAll
   with Matchers with GeneratorDrivenPropertyChecks {
@@ -233,8 +233,9 @@ class OperatorSuite extends FunSuite with BeforeAndAfterAll
       val start = scala.util.Random.nextFloat() * 5
       val stop = start + scala.util.Random.nextFloat() * 100
       val step = scala.util.Random.nextFloat() * 4
-      val repeat = (scala.util.Random.nextFloat() * 5).toInt + 1
-      val result = (start until stop by step).flatMap(x => Array.fill[Float](repeat)(x))
+      val repeat = 1
+      val result = (start.toDouble until stop.toDouble by step.toDouble)
+        .flatMap(x => Array.fill[Float](repeat)(x.toFloat))
       val x = Symbol.arange(start = start, stop = Some(stop), step = step, repeat = repeat)
       var exe = x.simpleBind(ctx = Context.cpu(), gradReq = "write", shapeDict = Map())
       exe.forward(isTrain = false)