提交 1cb3bead 编写于 作者: Y yanghaitao

skip black line for TextFileDataset

上级 7c7d95ac
......@@ -143,6 +143,9 @@ Status TextFileOp::LoadFile(const std::string &file, const int64_t start_offset,
std::unique_ptr<TensorQTable> tensor_table = std::make_unique<TensorQTable>();
while (getline(handle, line)) {
if (line.empty()) {
continue;
}
// If read to the end offset of this file, break.
if (rows_total >= end_offset) {
break;
......@@ -425,7 +428,9 @@ int64_t TextFileOp::CountTotalRows(const std::string &file) {
std::string line;
int64_t count = 0;
while (getline(handle, line)) {
count++;
if (!line.empty()) {
count++;
}
}
return count;
......
This is a text file.
Be happy every day.
Good luck to everyone.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册