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

Function TimeEstimateForNode

tensorflow/core/graph/costmodel.cc:444–452  ·  view source on GitHub ↗

This generates an extremely simple initial guess for the computation cost of each node. For ordinary Ops, its value should quickly be wiped out by the real runtime measurements. For other Ops we don't actually generate measurements, so suppression of infrequent Ops ends up giving them 0 costs. So, this is not of much consequence except perhaps in tests.

Source from the content-addressed store, hash-verified

442// giving them 0 costs. So, this is not of much consequence except perhaps
443// in tests.
444static Microseconds TimeEstimateForNode(CostModel* cost_model, Node* n) {
445 CHECK(n->IsOp());
446 VLOG(2) << "Node " << n->id() << ": " << n->name()
447 << " type_string: " << n->type_string();
448 if (IsConstant(n) || IsVariable(n)) {
449 return Microseconds(0);
450 }
451 return kDefaultTimeEstimate;
452}
453
454static void EstimateComputationCosts(const Graph& g, CostModel* cost_model) {
455 for (Node* n : g.nodes()) {

Callers 1

EstimateComputationCostsFunction · 0.85

Calls 5

IsOpMethod · 0.80
IsConstantFunction · 0.70
IsVariableFunction · 0.70
nameMethod · 0.65
idMethod · 0.45

Tested by

no test coverage detected