| 1817 | } |
| 1818 | |
| 1819 | Status SavedModelOptimizer::ConvertToHashLookupOp( |
| 1820 | Node* node, std::vector<SrcInfo>& input_info) { |
| 1821 | std::unordered_map<std::string, std::string> attr_info_map; |
| 1822 | |
| 1823 | // KvResourceGather -> LookupTableFindV2 |
| 1824 | attr_info_map["dtype"] = "Tout"; |
| 1825 | attr_info_map["Tkeys"] = "Tin"; |
| 1826 | |
| 1827 | AttrValue* dtype_attr = nullptr; |
| 1828 | Status s_attr = GetNodeAttr(node, "dtype", &dtype_attr); |
| 1829 | TF_RETURN_IF_ERROR(s_attr); |
| 1830 | |
| 1831 | // create a defaualt value node |
| 1832 | Node* default_value_node = nullptr; |
| 1833 | int dim = 0; |
| 1834 | Status s_shape_value = GetShapeValue(input_info[0].src_node, &dim); |
| 1835 | TF_RETURN_IF_ERROR(s_shape_value); |
| 1836 | // shape = [dim] |
| 1837 | Status s_default_value = CreateDefaultValueNode( |
| 1838 | &graph_, dim, &default_value_node, dtype_attr->type(), |
| 1839 | input_info[2].src_node->name() + "/new_default_value"); |
| 1840 | TF_RETURN_IF_ERROR(s_default_value); |
| 1841 | |
| 1842 | // use newly created default value node(filled by zeros) |
| 1843 | input_info[2].src_node = default_value_node; |
| 1844 | input_info[2].src_slot = 0; |
| 1845 | return ReplaceNode( |
| 1846 | "LookupTableFindV2", node, &graph_, input_info, |
| 1847 | attr_info_map); |
| 1848 | } |
| 1849 | |
| 1850 | Status SavedModelOptimizer::ConvertToHashImportOp( |
| 1851 | Node* node, std::vector<SrcInfo>& input_info) { |
nothing calls this directly
no test coverage detected