Generate formatted intro for run-start UI. Args: run_call_count: (int) Run call counter. fetches: Fetches of the `Session.run()` call. See doc of `Session.run()` for more details. feed_dict: Feeds to the `Session.run()` call. See doc of `Session.run()` for more details.
(run_call_count,
fetches,
feed_dict,
tensor_filters,
is_callable_runner=False)
| 277 | |
| 278 | |
| 279 | def get_run_start_intro(run_call_count, |
| 280 | fetches, |
| 281 | feed_dict, |
| 282 | tensor_filters, |
| 283 | is_callable_runner=False): |
| 284 | """Generate formatted intro for run-start UI. |
| 285 | |
| 286 | Args: |
| 287 | run_call_count: (int) Run call counter. |
| 288 | fetches: Fetches of the `Session.run()` call. See doc of `Session.run()` |
| 289 | for more details. |
| 290 | feed_dict: Feeds to the `Session.run()` call. See doc of `Session.run()` |
| 291 | for more details. |
| 292 | tensor_filters: (dict) A dict from tensor-filter name to tensor-filter |
| 293 | callable. |
| 294 | is_callable_runner: (bool) whether a runner returned by |
| 295 | Session.make_callable is being run. |
| 296 | |
| 297 | Returns: |
| 298 | (RichTextLines) Formatted intro message about the `Session.run()` call. |
| 299 | """ |
| 300 | |
| 301 | fetch_lines = common.get_flattened_names(fetches) |
| 302 | |
| 303 | if not feed_dict: |
| 304 | feed_dict_lines = [debugger_cli_common.RichLine(" (Empty)")] |
| 305 | else: |
| 306 | feed_dict_lines = [] |
| 307 | for feed_key in feed_dict: |
| 308 | feed_key_name = common.get_graph_element_name(feed_key) |
| 309 | feed_dict_line = debugger_cli_common.RichLine(" ") |
| 310 | feed_dict_line += debugger_cli_common.RichLine( |
| 311 | feed_key_name, |
| 312 | debugger_cli_common.MenuItem(None, "pf '%s'" % feed_key_name)) |
| 313 | # Surround the name string with quotes, because feed_key_name may contain |
| 314 | # spaces in some cases, e.g., SparseTensors. |
| 315 | feed_dict_lines.append(feed_dict_line) |
| 316 | feed_dict_lines = debugger_cli_common.rich_text_lines_from_rich_line_list( |
| 317 | feed_dict_lines) |
| 318 | |
| 319 | out = debugger_cli_common.RichTextLines(_HORIZONTAL_BAR) |
| 320 | if is_callable_runner: |
| 321 | out.append("Running a runner returned by Session.make_callable()") |
| 322 | else: |
| 323 | out.append("Session.run() call #%d:" % run_call_count) |
| 324 | out.append("") |
| 325 | out.append("Fetch(es):") |
| 326 | out.extend(debugger_cli_common.RichTextLines( |
| 327 | [" " + line for line in fetch_lines])) |
| 328 | out.append("") |
| 329 | out.append("Feed dict:") |
| 330 | out.extend(feed_dict_lines) |
| 331 | out.append(_HORIZONTAL_BAR) |
| 332 | out.append("") |
| 333 | out.append("Select one of the following commands to proceed ---->") |
| 334 | |
| 335 | out.extend( |
| 336 | _recommend_command( |
nothing calls this directly
no test coverage detected