Skip to content

Commit

Permalink
Record the tfrecord name
Browse files Browse the repository at this point in the history
  • Loading branch information
cheyang committed Mar 19, 2020
1 parent 590d6ee commit 5401562
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions tensorflow/core/lib/io/random_inputstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ class RandomAccessInputStream : public InputStreamInterface {
}

Status Reset() override { return Seek(0); }

private:
RandomAccessFile* file_; // Not owned.
private:
int64 pos_ = 0; // Tracks where we are in the file.
bool owns_file_ = false;
};
Expand Down
6 changes: 5 additions & 1 deletion tensorflow/core/lib/io/record_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ Status RecordReader::ReadChecksummed(uint64 offset, size_t n, string* result) {

const uint32 masked_crc = core::DecodeFixed32(result->data() + n);
if (crc32c::Unmask(masked_crc) != crc32c::Value(result->data(), n)) {
return errors::DataLoss("corrupted record at ", offset);
auto rai = dynamic_cast<RandomAccessInputStream *>(input_stream_.get());

tensorflow::StringPiece file_name;
rai->file_->Name(&file_name);
return errors::DataLoss("corrupted record at file:", file_name, " offset: ", offset);
}
result->resize(n);
return Status::OK();
Expand Down

0 comments on commit 5401562

Please sign in to comment.