From 53e697c11d30a84e59fab7d1c1d54718eed14f66 Mon Sep 17 00:00:00 2001 From: fengjiayi Date: Fri, 2 Feb 2018 00:06:46 +0800 Subject: [PATCH] refine code --- paddle/framework/reader.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/paddle/framework/reader.h b/paddle/framework/reader.h index 8275ea474b4..f450e67689a 100644 --- a/paddle/framework/reader.h +++ b/paddle/framework/reader.h @@ -66,9 +66,8 @@ class RandomReader : public FileReader { public: RandomReader(const std::vector& shapes, float min, float max) : FileReader(shapes), min_(min), max_(max) { - PADDLE_ENFORCE_LE(min, max, - "'min' should be less than or equal to 'max'.(%f vs %f)", - min, max); + PADDLE_ENFORCE_LE( + min, max, "'min' shouldn't be greater than 'max'.(%f vs %f)", min, max); unsigned int seed = std::random_device()(); engine_.seed(seed); dist_ = std::uniform_real_distribution(min_, max_); @@ -103,7 +102,7 @@ class RandomReader : public FileReader { std::uniform_real_distribution dist_; }; -// decorators +// decorated readers class ShuffleReader : public DecoratedReader { public: @@ -134,6 +133,8 @@ class BatchReader : public DecoratedReader { std::vector> buffer_; }; +// The ReaderHolder is used as readers' unified wrapper, +// making it easier to access different type readers in Variables. class ReaderHolder { public: void Reset(ReaderBase* reader) { reader_.reset(reader); } -- GitLab