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

Function HasDynamicShapeOutput

serving/processor/framework/util/utils.cc:38–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38bool HasDynamicShapeOutput(NodeDef* node_def) {
39 AttrValue attr_value = (*node_def->mutable_attr())["_output_shapes"];
40
41 Status s = AttrValueHasType(attr_value, "list(shape)");
42 if (!s.ok()) {
43 s = AttrValueHasType(attr_value, "shape");
44 if (!s.ok()) return true;
45 for (auto d : attr_value.shape().dim()) {
46 if (d.size() == -1) return true;
47 }
48 return false;
49 }
50
51 for (const auto& v : attr_value.list().shape()) {
52 for (auto d : v.dim()) {
53 if (d.size() == -1) return true;
54 }
55 }
56
57 return false;
58}
59
60std::unordered_map<std::string, bool> GetNodesHasDynamicShapeMap(const GraphDef& gdef) {
61 // NOTE(jiankeng.pt): should be optimized via topological sort algorithm later

Callers 2

TESTFunction · 0.85

Calls 6

AttrValueHasTypeFunction · 0.85
listMethod · 0.80
okMethod · 0.45
dimMethod · 0.45
shapeMethod · 0.45
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.68