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

Function GetDescriptorPoolFromFile

tensorflow/core/util/proto/descriptors.cc:46–65  ·  view source on GitHub ↗

Build a `DescriptorPool` from the named file or URI. The file or URI must be available to the current TensorFlow environment. The file must contain a serialized `FileDescriptorSet`. See `GetDescriptorPool()` for more information.

Source from the content-addressed store, hash-verified

44// The file must contain a serialized `FileDescriptorSet`. See
45// `GetDescriptorPool()` for more information.
46Status GetDescriptorPoolFromFile(
47 tensorflow::Env* env, const string& filename,
48 std::unique_ptr<protobuf::DescriptorPool>* owned_desc_pool) {
49 Status st = env->FileExists(filename);
50 if (!st.ok()) {
51 return st;
52 }
53 // Read and parse the FileDescriptorSet.
54 protobuf::FileDescriptorSet descs;
55 std::unique_ptr<ReadOnlyMemoryRegion> buf;
56 st = env->NewReadOnlyMemoryRegionFromFile(filename, &buf);
57 if (!st.ok()) {
58 return st;
59 }
60 if (!descs.ParseFromArray(buf->data(), buf->length())) {
61 return errors::InvalidArgument(
62 "descriptor_source contains invalid FileDescriptorSet: ", filename);
63 }
64 return CreatePoolFromSet(descs, owned_desc_pool);
65}
66
67Status GetDescriptorPoolFromBinary(
68 const string& source,

Callers 1

GetDescriptorPoolFunction · 0.85

Calls 7

InvalidArgumentFunction · 0.85
CreatePoolFromSetFunction · 0.85
FileExistsMethod · 0.45
okMethod · 0.45
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected