提交 611716e9 编写于 作者: F fengjiayi

Merge branch 'dev_reader_shutdown_start' of...

Merge branch 'dev_reader_shutdown_start' of https://github.com/JiayiFeng/Paddle into dev_reader_shutdown_start
......@@ -39,7 +39,7 @@ void ReaderBase::Start() {
}
}
ReaderBase::~ReaderBase() {}
ReaderBase::~ReaderBase() { Shutdown(); }
} // namespace framework
} // namespace paddle
......@@ -39,9 +39,9 @@ class ReaderBase {
protected:
virtual void ReadNextImpl(std::vector<LoDTensor>* out) = 0;
virtual void ShutdownImpl() = 0;
virtual void ShutdownImpl() {}
virtual void StartImpl() = 0;
virtual void StartImpl() {}
ReaderStatus status_{kRunning};
......@@ -63,15 +63,8 @@ class DecoratedReader : public ReaderBase {
std::shared_ptr<ReaderBase> reader_;
};
class FileReader : public ReaderBase {
public:
FileReader() : ReaderBase() {}
protected:
void ShutdownImpl() override {}
void StartImpl() override {}
};
// FileReader is just a conceptual class.
class FileReader : public ReaderBase {};
// The ReaderHolder is used as reader' unified wrapper,
// making it easier to access different type reader in Variables.
......
......@@ -56,8 +56,8 @@ class CreatePyReaderOp : public framework::OperatorBase {
const std::string& queue_name = Input("blocking_queue");
auto* queue_holder_var = scope.FindVar(queue_name);
PADDLE_ENFORCE(
queue_holder_var != nullptr,
PADDLE_ENFORCE_NOT_NULL(
queue_holder_var,
"No LoDTensorBlockingQueueHolder variable with name %s found",
queue_name);
auto* queue_holder =
......
......@@ -22,8 +22,7 @@ template <bool ThreadSafe>
class RecordIOFileReader : public framework::FileReader {
public:
explicit RecordIOFileReader(const std::string& filename)
: FileReader(),
scanner_(filename),
: scanner_(filename),
dev_ctx_(*platform::DeviceContextPool::Instance().Get(
platform::CPUPlace())) {
if (ThreadSafe) {
......@@ -42,7 +41,7 @@ class RecordIOFileReader : public framework::FileReader {
}
}
void ShutdownImpl() override { scanner_.Reset(); }
void StartImpl() override { scanner_.Reset(); }
private:
std::unique_ptr<std::mutex> mutex_;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册