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

Method LoadModel

tensorflow/lite/testing/tf_driver.cc:131–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131void TfDriver::LoadModel(const string& bin_file_path) {
132 if (!IsValid()) return;
133 std::ifstream model(bin_file_path);
134 if (model.fail()) {
135 Invalidate("Failed to find the model " + bin_file_path);
136 return;
137 }
138
139 tensorflow::GraphDef graphdef;
140 if (!graphdef.ParseFromIstream(&model)) {
141 Invalidate("Failed to parse tensorflow graphdef");
142 return;
143 }
144
145 tensorflow::SessionOptions options;
146 session_.reset(tensorflow::NewSession(options));
147 auto status = session_->Create(graphdef);
148 if (!status.ok()) {
149 Invalidate("Failed to create session. " + status.error_message());
150 }
151}
152
153void TfDriver::SetInput(const string& values_as_string,
154 tensorflow::Tensor* tensor) {

Callers 5

RunDiffTestFunction · 0.45
SetFieldMethod · 0.45
TESTFunction · 0.45
TESTFunction · 0.45

Calls 6

IsValidFunction · 0.85
failMethod · 0.80
NewSessionFunction · 0.50
resetMethod · 0.45
CreateMethod · 0.45
okMethod · 0.45

Tested by 4

SetFieldMethod · 0.36
TESTFunction · 0.36
TESTFunction · 0.36