TODO(irving): Change const NodeDef& to const Node&
| 1318 | |
| 1319 | // TODO(irving): Change const NodeDef& to const Node& |
| 1320 | Status FindKernelDef( |
| 1321 | const DeviceType& device_type, StringPiece node_name, |
| 1322 | bool has_experimental_debug_info, |
| 1323 | const NodeDef_ExperimentalDebugInfo& experimental_debug_info, |
| 1324 | StringPiece node_op, StringPiece node_device, AttrSlice node_attrs, |
| 1325 | const KernelDef** def, string* kernel_class_name) { |
| 1326 | const KernelRegistration* reg = nullptr; |
| 1327 | bool was_attr_mismatch; |
| 1328 | TF_RETURN_IF_ERROR(FindKernelRegistration( |
| 1329 | device_type, node_name, has_experimental_debug_info, |
| 1330 | experimental_debug_info, node_op, node_attrs, ®, &was_attr_mismatch)); |
| 1331 | if (reg == nullptr) { |
| 1332 | Status s = errors::NotFound( |
| 1333 | "No registered '", node_op, "' OpKernel for ", |
| 1334 | DeviceTypeString(device_type), " devices compatible with node ", |
| 1335 | FormatNodeDefForError(node_name, has_experimental_debug_info, |
| 1336 | experimental_debug_info)); |
| 1337 | if (was_attr_mismatch) { |
| 1338 | errors::AppendToMessage( |
| 1339 | &s, " (OpKernel was found, but attributes didn't match) ", |
| 1340 | "Requested Attributes: ", |
| 1341 | SummarizeAttrsHelper(node_attrs, node_device)); |
| 1342 | } |
| 1343 | errors::AppendToMessage(&s, |
| 1344 | ". Registered:", KernelsRegisteredForOp(node_op)); |
| 1345 | return s; |
| 1346 | } |
| 1347 | if (def != nullptr) *def = ®->def; |
| 1348 | if (kernel_class_name != nullptr) *kernel_class_name = reg->kernel_class_name; |
| 1349 | return Status::OK(); |
| 1350 | } |
| 1351 | |
| 1352 | Status FindKernelDef(const DeviceType& device_type, const NodeDef& node_def, |
| 1353 | const KernelDef** def, string* kernel_class_name) { |