From 0deffe92c5fc4fb54f875ea34403c50c520e5c28 Mon Sep 17 00:00:00 2001 From: "Per G. da Silva" Date: Tue, 11 Sep 2018 20:24:06 +0200 Subject: [PATCH] Sets random seed prior to thread initialization --- src/io/iter_image_recordio.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/io/iter_image_recordio.cc b/src/io/iter_image_recordio.cc index e8dcbef2e909..fdb88cc3f366 100644 --- a/src/io/iter_image_recordio.cc +++ b/src/io/iter_image_recordio.cc @@ -264,6 +264,8 @@ class ImageRecordIter : public IIterator { parser_.Init(kwargs); // prefetch at most 4 minbatches iter_.set_max_capacity(4); + // set random seed + rnd_.seed(kRandMagic + param_.seed); // init thread iter iter_.Init([this](std::vector> **dptr) { if (*dptr == nullptr) { @@ -273,7 +275,6 @@ class ImageRecordIter : public IIterator { }, [this]() { parser_.BeforeFirst(); }); inst_ptr_ = 0; - rnd_.seed(kRandMagic + param_.seed); } // before first virtual void BeforeFirst(void) {