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

Method profile_python

tensorflow/python/profiler/model_analyzer.py:207–226  ·  view source on GitHub ↗

Profile the statistics of the Python codes. By default, it shows the call stack from root. To avoid redundant output, you may use options to filter as below options['show_name_regexes'] = ['.*my_code.py.*'] Args: options: A dict of options. See core/profiler/g3doc/opt

(self, options)

Source from the content-addressed store, hash-verified

205 op_log.SerializeToString())
206
207 def profile_python(self, options):
208 """Profile the statistics of the Python codes.
209
210 By default, it shows the call stack from root. To avoid
211 redundant output, you may use options to filter as below
212 options['show_name_regexes'] = ['.*my_code.py.*']
213
214 Args:
215 options: A dict of options. See core/profiler/g3doc/options.md.
216 Returns:
217 a MultiGraphNodeProto that records the results.
218 """
219 opts = _build_options(options)
220 tfprof_node = tfprof_output_pb2.MultiGraphNodeProto()
221 try:
222 tfprof_node.ParseFromString(
223 print_mdl.Profile('code'.encode('utf-8'), opts.SerializeToString()))
224 except message.DecodeError as e:
225 sys.stderr.write('Cannot parse returned proto: %s.\n' % e)
226 return tfprof_node
227
228 def profile_operations(self, options):
229 """Profile the statistics of the Operation types (e.g. MatMul, Conv2D).

Callers 3

testProfileBasicMethod · 0.95
_profiled_runFunction · 0.80
testComplexCodeViewMethod · 0.80

Calls 6

_build_optionsFunction · 0.85
ParseFromStringMethod · 0.45
ProfileMethod · 0.45
encodeMethod · 0.45
SerializeToStringMethod · 0.45
writeMethod · 0.45

Tested by 2

testProfileBasicMethod · 0.76
testComplexCodeViewMethod · 0.64