MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / New

Method New

tensorflow/python/lib/io/py_record_reader.cc:35–54  ·  view source on GitHub ↗

NOTE(sethtroisi): At this time PyRecordReader doesn't benefit from taking RecordReaderOptions, if this changes the API can be updated at that time.

Source from the content-addressed store, hash-verified

33// NOTE(sethtroisi): At this time PyRecordReader doesn't benefit from taking
34// RecordReaderOptions, if this changes the API can be updated at that time.
35PyRecordReader* PyRecordReader::New(const string& filename, uint64 start_offset,
36 const string& compression_type_string,
37 TF_Status* out_status) {
38 std::unique_ptr<RandomAccessFile> file;
39 Status s = Env::Default()->NewRandomAccessFile(filename, &file);
40 if (!s.ok()) {
41 Set_TF_Status_from_Status(out_status, s);
42 return nullptr;
43 }
44 PyRecordReader* reader = new PyRecordReader;
45 reader->offset_ = start_offset;
46 reader->file_ = file.release();
47
48 static const uint64 kReaderBufferSize = 16 * 1024 * 1024;
49 RecordReaderOptions options =
50 RecordReaderOptions::CreateRecordReaderOptions(compression_type_string);
51 options.buffer_size = kReaderBufferSize;
52 reader->reader_ = new RecordReader(reader->file_, options);
53 return reader;
54}
55
56PyRecordReader::~PyRecordReader() {
57 delete reader_;

Callers

nothing calls this directly

Calls 5

DefaultFunction · 0.85
NewRandomAccessFileMethod · 0.45
okMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected