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

Method MeasureCosts

tensorflow/python/grappler/cluster.py:88–105  ·  view source on GitHub ↗

Returns the cost of running the specified item. Args: item: The item for which to measure the costs. Returns: The triplet op_perfs, runtime, step_stats.

(self, item)

Source from the content-addressed store, hash-verified

86 return tf_cluster.TF_EstimatePerformance(device.SerializeToString())
87
88 def MeasureCosts(self, item):
89 """Returns the cost of running the specified item.
90
91 Args:
92 item: The item for which to measure the costs.
93 Returns: The triplet op_perfs, runtime, step_stats.
94 """
95 ret_from_swig = tf_cluster.TF_MeasureCosts(item.tf_item, self._tf_cluster,
96 self._generate_timeline)
97
98 if ret_from_swig is None:
99 return None
100
101 op_perf_bytes_list, run_time, step_stats_bytes = ret_from_swig
102 op_perfs = [op_performance_data_pb2.OpPerformance.FromString(op_perf_bytes)
103 for op_perf_bytes in op_perf_bytes_list]
104 return (op_perfs, run_time,
105 step_stats_pb2.StepStats.FromString(step_stats_bytes))
106
107 def DeterminePeakMemoryUsage(self, item):
108 """Returns a snapshot of the peak memory usage.

Callers 6

PlaceGraphFunction · 0.95
testBasicMethod · 0.95
testNoDetailedStatsMethod · 0.95
testVirtualClusterMethod · 0.95
eval_placementMethod · 0.80
testContextMethod · 0.80

Calls

no outgoing calls

Tested by 4

testBasicMethod · 0.76
testNoDetailedStatsMethod · 0.76
testVirtualClusterMethod · 0.76
testContextMethod · 0.64