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

Function RunRegression

tensorflow/contrib/session_bundle/signature.cc:170–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170Status RunRegression(const RegressionSignature& signature,
171 const Tensor& regression_input, Session* session,
172 Tensor* regression_output) {
173 std::vector<string> output_tensor_names;
174 if (regression_output) {
175 output_tensor_names.push_back(signature.output().tensor_name());
176 }
177 // Run the graph with our inputs and outputs.
178 std::vector<Tensor> outputs;
179 const Status run_status =
180 session->Run({{signature.input().tensor_name(), regression_input}},
181 output_tensor_names, {}, &outputs);
182 if (!run_status.ok()) {
183 return run_status;
184 }
185 // Ensure the regression score output is shaped how we expect.
186 // There should be one float Tensor of shape,
187 // [batch_size, num_recommendations].
188 if (outputs.size() != output_tensor_names.size()) {
189 return errors::Internal(
190 strings::StrCat("Expected ", output_tensor_names.size(),
191 " output tensor(s). Got: ", outputs.size()));
192 }
193 if (regression_output) {
194 *regression_output = outputs[0];
195 TF_RETURN_IF_ERROR(BatchSizesMatch(regression_input, *regression_output));
196 }
197 return Status::OK();
198}
199
200Status GetGenericSignature(const string& name,
201 const tensorflow::MetaGraphDef& meta_graph_def,

Callers 1

TEST_FFunction · 0.85

Calls 10

InternalFunction · 0.85
BatchSizesMatchFunction · 0.85
outputMethod · 0.65
StrCatFunction · 0.50
push_backMethod · 0.45
tensor_nameMethod · 0.45
RunMethod · 0.45
inputMethod · 0.45
okMethod · 0.45
sizeMethod · 0.45

Tested by 1

TEST_FFunction · 0.68