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

Method eval_step

tensorflow/contrib/compiler/xla.py:147–175  ·  view source on GitHub ↗

A single step of evaluation.

()

Source from the content-addressed store, hash-verified

145 captured_scaffold_fn = _CapturedObject()
146
147 def eval_step():
148 """A single step of evaluation."""
149 estimator_spec = self._call_model_fn(features, labels,
150 model_fn_lib.ModeKeys.EVAL, params)
151
152 try:
153 captured_scaffold_fn.capture(estimator_spec.scaffold_fn)
154 except AttributeError:
155 captured_scaffold_fn.capture(None)
156
157 eval_metric_fn = None
158 eval_metric_fn_tensors = []
159 try:
160 if estimator_spec.eval_metrics:
161 (eval_metric_fn, eval_metric_fn_tensors) = estimator_spec.eval_metrics
162 except AttributeError:
163 pass
164
165 # If a dictionary is provided, we need to convert it into a list sorted
166 # according to order of eval_metric_fn positional arguments.
167 if isinstance(eval_metric_fn_tensors, dict):
168 eval_metric_fn_args = function_utils.fn_args(eval_metric_fn)
169 eval_metric_fn_tensors = [
170 eval_metric_fn_tensors[i] for i in eval_metric_fn_args
171 ]
172
173 captured_eval_metric_fn.capture(eval_metric_fn)
174
175 return tuple([estimator_spec.loss] + eval_metric_fn_tensors)
176
177 return eval_step, captured_eval_metric_fn, captured_scaffold_fn
178

Callers

nothing calls this directly

Calls 3

_call_model_fnMethod · 0.95
tupleFunction · 0.85
captureMethod · 0.45

Tested by

no test coverage detected