Skip to content

Commit

Permalink
set seed to avoid random error in PredictionServiceUT (intel-analytic…
Browse files Browse the repository at this point in the history
  • Loading branch information
Le-Zheng committed Dec 10, 2020
1 parent fb2da24 commit b19a259
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.intel.analytics.bigdl.optim

import com.intel.analytics.bigdl.nn._
import com.intel.analytics.bigdl.tensor.Tensor
import com.intel.analytics.bigdl.utils.RandomGenerator.RNG
import com.intel.analytics.bigdl.utils.T
import org.scalatest.{FlatSpec, Matchers}

Expand Down Expand Up @@ -134,6 +135,8 @@ class PredictionServiceSpec extends FlatSpec with Matchers {
val service = PredictionService[Float](testModule, 4)
val service2 = PredictionService[Float](testModule, 1)

RNG.setSeed(100)

val sumResults = (1 to 100).par.map { _ =>
val tensor = Tensor[Float](2, 10).randn()
val output = service.predict(tensor).asInstanceOf[Tensor[Float]]
Expand Down

0 comments on commit b19a259

Please sign in to comment.