Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Sets random seed prior to thread initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
perdasilva committed Sep 11, 2018
1 parent 6aa8d75 commit 0deffe9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/io/iter_image_recordio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ class ImageRecordIter : public IIterator<DataInst> {
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<InstVector<DType>> **dptr) {
if (*dptr == nullptr) {
Expand All @@ -273,7 +275,6 @@ class ImageRecordIter : public IIterator<DataInst> {
},
[this]() { parser_.BeforeFirst(); });
inst_ptr_ = 0;
rnd_.seed(kRandMagic + param_.seed);
}
// before first
virtual void BeforeFirst(void) {
Expand Down

0 comments on commit 0deffe9

Please sign in to comment.