未验证 提交 e8ee9dc7 编写于 作者: Y yuyang18

Several Polish

上级 0d2ccfbd
......@@ -36,7 +36,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};
};
......@@ -61,15 +61,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.
先完成此消息的编辑!
想要评论请 注册