MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetShapeValue

Function GetShapeValue

serving/processor/framework/graph_optimizer.cc:730–753  ·  view source on GitHub ↗

for KvVarHandleOp and MutableHashTableOfTensorsV2

Source from the content-addressed store, hash-verified

728
729// for KvVarHandleOp and MutableHashTableOfTensorsV2
730Status 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
755bool IsKvOps(const Node* node) {
756 return node->op_def().name() == "KvResourceGather" ||

Callers 3

ConvertKVOpsMethod · 0.85
ConvertToHashLookupOpMethod · 0.85

Calls 9

AttrValueHasTypeFunction · 0.85
InternalFunction · 0.85
FindMethod · 0.45
attrsMethod · 0.45
okMethod · 0.45
DebugStringMethod · 0.45
sizeMethod · 0.45
dimMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected