From c0257f0a5b315bb39f2c3e92c5afe43d631eae69 Mon Sep 17 00:00:00 2001 From: JiayiFeng Date: Sat, 31 Mar 2018 05:17:57 +0000 Subject: [PATCH] Add comments --- .../operators/reader/create_double_buffer_reader_op.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc b/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc index f15747e266..3f1d36a3e6 100644 --- a/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc +++ b/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc @@ -20,7 +20,14 @@ namespace paddle { namespace operators { namespace reader { +// 'Double buffer' means we shall maintain two batch of input data at the same +// time. So the kCacheSize shoul be at least 2. static constexpr size_t kCacheSize = 2; +// There will be two bacthes out of the channel during training: +// 1. the one waiting to be sent to the channel +// 2. the one just be received from the channel, which is also being used by +// subsequent operators. +// So the channel size should be kChacheSize - 2 static constexpr size_t kChannelSize = 0; // kCacheSize - 2 class DoubleBufferReader : public framework::DecoratedReader { -- GitLab