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

Method UseHelper

tensorflow/c/c_api_function_test.cc:215–227  ·  view source on GitHub ↗

All the *Helper methods are used as a workaround for the restrictions that one cannot call ASSERT_* methods in non-void-returning functions (when exceptions are disabled during compilation)

Source from the content-addressed store, hash-verified

213 // one cannot call ASSERT_* methods in non-void-returning functions (when
214 // exceptions are disabled during compilation)
215 void UseHelper(const std::vector<TF_Output>& inputs, TF_Operation** op) {
216 TF_OperationDescription* desc =
217 TF_NewOperation(host_graph_, func_name_, func_node_name_);
218 for (auto input : inputs) {
219 TF_AddInput(desc, input);
220 }
221 // Set device to CPU because some ops inside the function might not be
222 // available on GPU.
223 TF_SetDevice(desc, "/cpu:0");
224 *op = TF_FinishOperation(desc, s_);
225 ASSERT_EQ(TF_OK, TF_GetCode(s_)) << TF_Message(s_);
226 ASSERT_NE(*op, nullptr);
227 }
228
229 FunctionDef fdef() {
230 tensorflow::FunctionDef fdef;

Callers

nothing calls this directly

Calls 6

TF_NewOperationFunction · 0.85
TF_AddInputFunction · 0.85
TF_SetDeviceFunction · 0.85
TF_FinishOperationFunction · 0.85
TF_GetCodeFunction · 0.85
TF_MessageFunction · 0.85

Tested by

no test coverage detected