| 1648 | } |
| 1649 | |
| 1650 | NodeDef FunctionDefHelper::Node::ToNodeDef() const { |
| 1651 | NodeDef n; |
| 1652 | n.set_op(this->op); |
| 1653 | n.set_name(this->ret[0]); |
| 1654 | for (const auto& a : this->attr) { |
| 1655 | n.mutable_attr()->insert({a.first, a.second.proto}); |
| 1656 | } |
| 1657 | for (const string& a : this->arg) { |
| 1658 | n.add_input(a); |
| 1659 | } |
| 1660 | for (const string& d : this->dep) { |
| 1661 | n.add_input(strings::StrCat("^", d)); |
| 1662 | } |
| 1663 | if (!this->device.empty()) { |
| 1664 | n.set_device(this->device); |
| 1665 | } |
| 1666 | return n; |
| 1667 | } |
| 1668 | |
| 1669 | /* static */ |
| 1670 | FunctionDef FunctionDefHelper::Create( |