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

Function ReadEventFromFile

tensorflow/core/debug/debug_io_utils.cc:295–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293const char* const DebugIO::kHashTag = "hash";
294
295Status ReadEventFromFile(const string& dump_file_path, Event* event) {
296 Env* env(Env::Default());
297
298 string content;
299 uint64 file_size = 0;
300
301 Status s = env->GetFileSize(dump_file_path, &file_size);
302 if (!s.ok()) {
303 return s;
304 }
305
306 content.resize(file_size);
307
308 std::unique_ptr<RandomAccessFile> file;
309 s = env->NewRandomAccessFile(dump_file_path, &file);
310 if (!s.ok()) {
311 return s;
312 }
313
314 StringPiece result;
315 s = file->Read(0, file_size, &result, &(content)[0]);
316 if (!s.ok()) {
317 return s;
318 }
319
320 event->ParseFromString(content);
321 return Status::OK();
322}
323
324const char* const DebugIO::kFileURLScheme = "file://";
325const char* const DebugIO::kGrpcURLScheme = "grpc://";

Callers 2

TEST_FFunction · 0.85
LoadTensorDumpsMethod · 0.85

Calls 6

GetFileSizeMethod · 0.45
okMethod · 0.45
resizeMethod · 0.45
NewRandomAccessFileMethod · 0.45
ReadMethod · 0.45
ParseFromStringMethod · 0.45

Tested by 2

TEST_FFunction · 0.68
LoadTensorDumpsMethod · 0.68