| 426 | }; |
| 427 | |
| 428 | Status MakeFunctionDefHelper::Initialize( |
| 429 | const GrapplerFunctionItem& item, const FunctionLibraryDefinition& flib) { |
| 430 | for (const InputArgInstantiation& input_arg : item.inputs()) { |
| 431 | input_nodes_.insert(input_arg.node_name); |
| 432 | } |
| 433 | for (const OutputArgInstantiation& output_arg : item.outputs()) { |
| 434 | output_nodes_.insert(output_arg.node_name); |
| 435 | } |
| 436 | |
| 437 | for (const NodeDef& node : item.function_body().node()) { |
| 438 | const OpRegistrationData* registration; |
| 439 | TF_RETURN_IF_ERROR(flib.LookUp(node.op(), ®istration)); |
| 440 | |
| 441 | tensorflow::NameRangeMap outputs_range_map; |
| 442 | TF_RETURN_IF_ERROR(tensorflow::NameRangesForNode( |
| 443 | node, registration->op_def, nullptr, &outputs_range_map)); |
| 444 | |
| 445 | function_body_outputs_.emplace(node.name(), std::move(outputs_range_map)); |
| 446 | } |
| 447 | |
| 448 | return Status::OK(); |
| 449 | } |
| 450 | |
| 451 | Status MakeFunctionDefHelper::AsFunctionDefInput(const string& graph_def_input, |
| 452 | string* func_def_input) const { |
no test coverage detected