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

Function evaluate

tensorflow/contrib/learn/python/learn/graph_actions.py:478–628  ·  view source on GitHub ↗

Evaluate a model loaded from a checkpoint. Given `graph`, a directory to write summaries to (`output_dir`), a checkpoint to restore variables from, and a `dict` of `Tensor`s to evaluate, run an eval loop for `max_steps` steps, or until an exception (generally, an end-of-input signal from a

(graph,
             output_dir,
             checkpoint_path,
             eval_dict,
             update_op=None,
             global_step_tensor=None,
             supervisor_master='',
             log_every_steps=10,
             feed_fn=None,
             max_steps=None)

Source from the content-addressed store, hash-verified

476
477@_graph_action_deprecation
478def evaluate(graph,
479 output_dir,
480 checkpoint_path,
481 eval_dict,
482 update_op=None,
483 global_step_tensor=None,
484 supervisor_master='',
485 log_every_steps=10,
486 feed_fn=None,
487 max_steps=None):
488 """Evaluate a model loaded from a checkpoint.
489
490 Given `graph`, a directory to write summaries to (`output_dir`), a checkpoint
491 to restore variables from, and a `dict` of `Tensor`s to evaluate, run an eval
492 loop for `max_steps` steps, or until an exception (generally, an
493 end-of-input signal from a reader operation) is raised from running
494 `eval_dict`.
495
496 In each step of evaluation, all tensors in the `eval_dict` are evaluated, and
497 every `log_every_steps` steps, they are logged. At the very end of evaluation,
498 a summary is evaluated (finding the summary ops using `Supervisor`'s logic)
499 and written to `output_dir`.
500
501 Args:
502 graph: A `Graph` to train. It is expected that this graph is not in use
503 elsewhere.
504 output_dir: A string containing the directory to write a summary to.
505 checkpoint_path: A string containing the path to a checkpoint to restore.
506 Can be `None` if the graph doesn't require loading any variables.
507 eval_dict: A `dict` mapping string names to tensors to evaluate. It is
508 evaluated in every logging step. The result of the final evaluation is
509 returned. If `update_op` is None, then it's evaluated in every step. If
510 `max_steps` is `None`, this should depend on a reader that will raise an
511 end-of-input exception when the inputs are exhausted.
512 update_op: A `Tensor` which is run in every step.
513 global_step_tensor: A `Variable` containing the global step. If `None`,
514 one is extracted from the graph using the same logic as in `Supervisor`.
515 Used to place eval summaries on training curves.
516 supervisor_master: The master string to use when preparing the session.
517 log_every_steps: Integer. Output logs every `log_every_steps` evaluation
518 steps. The logs contain the `eval_dict` and timing information.
519 feed_fn: A function that is called every iteration to produce a `feed_dict`
520 passed to `session.run` calls. Optional.
521 max_steps: Integer. Evaluate `eval_dict` this many times.
522
523 Returns:
524 A tuple `(eval_results, global_step)`:
525 eval_results: A `dict` mapping `string` to numeric values (`int`, `float`)
526 that are the result of running eval_dict in the last step. `None` if no
527 eval steps were run.
528 global_step: The global step this evaluation corresponds to.
529
530 Raises:
531 ValueError: if `output_dir` is empty.
532 """
533 if not output_dir:
534 raise ValueError('Output directory should be non-empty %s.' % output_dir)
535 with graph.as_default():

Callers 2

_test_input_iterationMethod · 0.50

Calls 15

recover_sessionMethod · 0.95
request_stopMethod · 0.95
joinMethod · 0.95
_get_local_init_opFunction · 0.85
_get_ready_opFunction · 0.85
_restore_from_checkpointFunction · 0.85
_eval_results_to_strFunction · 0.85
_write_summary_resultsFunction · 0.85
CoordinatorMethod · 0.80
infoMethod · 0.80
timeMethod · 0.80
_get_saverFunction · 0.70

Tested by 2

_test_input_iterationMethod · 0.40