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

Function advise

tensorflow/python/profiler/model_analyzer.py:385–420  ·  view source on GitHub ↗

Auto profile and advise. Builds profiles and automatically check anomalies of various aspects. For more details: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/core/profiler/README.md Args: graph: tf.Graph. If None and eager execution is not enabled, use

(graph=None, run_meta=None, options=_DEFAULT_ADVISE_OPTIONS)

Source from the content-addressed store, hash-verified

383
384@tf_export(v1=['profiler.advise'])
385def advise(graph=None, run_meta=None, options=_DEFAULT_ADVISE_OPTIONS):
386 """Auto profile and advise.
387
388 Builds profiles and automatically check anomalies of various
389 aspects. For more details:
390 https://github.com/tensorflow/tensorflow/tree/master/tensorflow/core/profiler/README.md
391
392 Args:
393 graph: tf.Graph. If None and eager execution is not enabled, use
394 default graph.
395 run_meta: optional tensorflow.RunMetadata proto. It is necessary to
396 to support run time information profiling, such as time and memory.
397 options: see ALL_ADVICE example above. Default checks everything.
398 Returns:
399 Returns AdviceProto proto
400 """
401 if not graph and not context.executing_eagerly():
402 graph = ops.get_default_graph()
403
404 if options == _DEFAULT_ADVISE_OPTIONS:
405 options = ALL_ADVICE.copy()
406
407 # pylint: disable=protected-access
408 op_log = tfprof_logger.merge_default_with_oplog(
409 graph, None, run_meta, add_trace=True)
410 # pylint: enable=protected-access
411
412 run_meta_str = run_meta.SerializeToString() if run_meta else b''
413
414 opts = _build_advisor_options(options)
415 ret = tfprof_output_pb2.AdviceProto()
416 ret.ParseFromString(
417 print_mdl.PrintModelAnalysis(
418 _graph_string(graph), run_meta_str, op_log.SerializeToString(),
419 'advise'.encode('utf-8'), opts.SerializeToString()))
420 return ret

Callers

nothing calls this directly

Calls 7

_build_advisor_optionsFunction · 0.85
_graph_stringFunction · 0.85
executing_eagerlyMethod · 0.80
copyMethod · 0.45
SerializeToStringMethod · 0.45
ParseFromStringMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected