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)
| 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). |