| 720 | } |
| 721 | |
| 722 | TF_Function* TF_FunctionImportFunctionDef(const void* proto, size_t proto_len, |
| 723 | TF_Status* status) { |
| 724 | TF_Function* func = new TF_Function(); |
| 725 | if (!func->fdef.ParseFromArray(proto, proto_len)) { |
| 726 | status->status = InvalidArgument( |
| 727 | "Invalid FunctionDef given to TF_FunctionImportFunctionDef"); |
| 728 | TF_DeleteFunction(func); |
| 729 | return nullptr; |
| 730 | } |
| 731 | status->status = tensorflow::Status::OK(); |
| 732 | return func; |
| 733 | } |
| 734 | |
| 735 | void TF_FunctionSetAttrValueProto(TF_Function* func, const char* attr_name, |
| 736 | const void* proto, size_t proto_len, |