| 1139 | } |
| 1140 | |
| 1141 | Status FunctionLibraryDefinition::AddHelper( |
| 1142 | std::shared_ptr<FunctionDefAndOpRegistration> registration, bool* added) { |
| 1143 | *added = false; |
| 1144 | std::shared_ptr<FunctionDefAndOpRegistration>& entry = |
| 1145 | function_defs_[registration->fdef.signature().name()]; |
| 1146 | if (entry) { |
| 1147 | if (!FunctionDefsEqual(entry->fdef, registration->fdef)) { |
| 1148 | return errors::InvalidArgument( |
| 1149 | "Cannot add function '", registration->fdef.signature().name(), |
| 1150 | "' because a different function with the same name already " |
| 1151 | "exists."); |
| 1152 | } |
| 1153 | // Ignore duplicate FunctionDefs. |
| 1154 | return Status::OK(); |
| 1155 | } |
| 1156 | const OpDef* op_def; |
| 1157 | if (default_registry_ |
| 1158 | ->LookUpOpDef(registration->fdef.signature().name(), &op_def) |
| 1159 | .ok()) { |
| 1160 | return errors::InvalidArgument( |
| 1161 | "Cannot add function '", registration->fdef.signature().name(), |
| 1162 | "' because an op with the same name already exists."); |
| 1163 | } |
| 1164 | entry = std::move(registration); |
| 1165 | *added = true; |
| 1166 | return Status::OK(); |
| 1167 | } |
| 1168 | |
| 1169 | Status FunctionLibraryDefinition::CopyFunctionDefFrom( |
| 1170 | const string& func, const FunctionLibraryDefinition& other) { |
nothing calls this directly
no test coverage detected