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

Method AnnotateOutputShapes

tensorflow/core/grappler/costs/graph_properties.cc:2379–2391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2377}
2378
2379Status GraphProperties::AnnotateOutputShapes(GraphDef* output_graph_def) const {
2380 *output_graph_def = item_.graph;
2381 for (int i = 0; i < output_graph_def->node_size(); i++) {
2382 auto node = output_graph_def->mutable_node(i);
2383 AttrValue attr_output_shape;
2384 auto tensor_properties = GetOutputProperties(node->name());
2385 for (const auto& tensor_property : tensor_properties) {
2386 *attr_output_shape.mutable_list()->add_shape() = tensor_property.shape();
2387 }
2388 (*node->mutable_attr())["_output_shapes"] = attr_output_shape;
2389 }
2390 return Status::OK();
2391}
2392
2393Status GraphProperties::InferFromCostGraph(const CostGraphDef& cost_graph) {
2394 if (cost_graph.node_size() == 0) {

Callers 2

TuneMethod · 0.80

Calls 4

GetOutputPropertiesFunction · 0.85
add_shapeMethod · 0.80
nameMethod · 0.65
shapeMethod · 0.45

Tested by

no test coverage detected