for KvVarHandleOp and MutableHashTableOfTensorsV2
| 728 | |
| 729 | // for KvVarHandleOp and MutableHashTableOfTensorsV2 |
| 730 | Status GetShapeValue(Node* node, int* dim) { |
| 731 | AttrValue* dim_len_value = |
| 732 | const_cast<AttrValue*>(node->attrs().Find("shape")); |
| 733 | if (!dim_len_value) { |
| 734 | dim_len_value = const_cast<AttrValue*>(node->attrs().Find("value_shape")); |
| 735 | } |
| 736 | |
| 737 | Status s = AttrValueHasType(*dim_len_value, "shape"); |
| 738 | if (!s.ok()) { |
| 739 | return tensorflow::errors::Internal( |
| 740 | "Miss shape attr in the KvVarHandleOp, ", |
| 741 | node->DebugString()); |
| 742 | } |
| 743 | |
| 744 | if (dim_len_value->shape().dim().size() == -1) { |
| 745 | return tensorflow::errors::Internal( |
| 746 | "Dim value of the shape in the KvVarHandleOp is unknown, ", |
| 747 | node->DebugString()); |
| 748 | } |
| 749 | |
| 750 | *dim = dim_len_value->shape().dim(0).size(); |
| 751 | |
| 752 | return Status::OK(); |
| 753 | } |
| 754 | |
| 755 | bool IsKvOps(const Node* node) { |
| 756 | return node->op_def().name() == "KvResourceGather" || |
no test coverage detected