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

Function TFE_NewOp

tensorflow/c/eager/c_api.cc:596–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

594}
595
596TFE_Op* TFE_NewOp(TFE_Context* ctx, const char* op_or_function_name,
597 TF_Status* status) {
598 const char* name = op_or_function_name; // Shorthand
599 const tensorflow::AttrTypeMap* types;
600 bool is_function = false;
601 status->status = tensorflow::AttrTypeMapForOp(name, &types, &is_function);
602 if (!status->status.ok()) {
603 return nullptr;
604 }
605 if (!is_function) {
606 const tensorflow::OpDef* op_def;
607 status->status = tensorflow::OpDefForOp(op_or_function_name, &op_def);
608 if (!status->status.ok()) {
609 return nullptr;
610 }
611 return new TFE_Op(ctx, name, false, types,
612 new TFE_OpInferenceContext(op_def));
613 }
614 if (!ctx->context->FindFunctionByName(name)) {
615 status->status = tensorflow::errors::NotFound(
616 "'", name,
617 "' is neither a type of a primitive operation nor a name "
618 "of a function registered in binary running on ",
619 tensorflow::port::Hostname(),
620 ". Make sure the operation or function is "
621 "registered in the binary running in this process.");
622 return nullptr;
623 }
624 return new TFE_Op(ctx, name, true, types, nullptr);
625}
626
627void TFE_DeleteOp(TFE_Op* op) { delete op; }
628

Callers 15

SetOpAttrListFunction · 0.85
GetFuncFunction · 0.85
TFE_Py_ExecuteCancelableFunction · 0.85
ReadVariableOpFunction · 0.85
TFE_Py_FastPathExecute_CFunction · 0.85
EagerCastFunction · 0.85
EvaluateOperationFunction · 0.85
createTFEQueueFunction · 0.85
createTFEEnqueueFunction · 0.85
createTFEDequeueFunction · 0.85
TESTFunction · 0.85

Calls 6

AttrTypeMapForOpFunction · 0.85
OpDefForOpFunction · 0.85
NotFoundFunction · 0.85
FindFunctionByNameMethod · 0.80
HostnameFunction · 0.50
okMethod · 0.45

Tested by 12

TESTFunction · 0.68
TEST_FFunction · 0.68
MatMulOpFunction · 0.68
IdentityOpFunction · 0.68
ShapeOpFunction · 0.68
MinOpFunction · 0.68
FunctionDefAndExecuteFunction · 0.68
BM_ExecuteFunctionFunction · 0.68
CreateVariableFunction · 0.68
TESTFunction · 0.68
BM_ReadVariableFunction · 0.68
TESTFunction · 0.68