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

Method PredictCosts

tensorflow/python/grappler/cost_analyzer.cc:43–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void CostAnalyzer::PredictCosts(CostEstimator* cost_estimator,
44 CostGraphDef* cost_graph, int64* total_time) {
45 TF_CHECK_OK(cost_estimator->Initialize(*item_));
46 RunMetadata run_metadata;
47 Costs costs;
48 const Status status =
49 cost_estimator->PredictCosts(item_->graph, &run_metadata, &costs);
50 if (cost_graph) {
51 cost_graph->Swap(run_metadata.mutable_cost_graph());
52 }
53 *total_time = costs.execution_time.count();
54 if (!status.ok()) {
55 LOG(ERROR) << "Could not estimate the cost for item " << item_->id << ": "
56 << status.error_message();
57 return;
58 }
59}
60
61void CostAnalyzer::GatherCosts() {
62 CostGraphDef cost_graph_measured;

Callers

nothing calls this directly

Calls 5

mutable_cost_graphMethod · 0.80
InitializeMethod · 0.45
SwapMethod · 0.45
countMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected