(self)
return model_fn_lib.EstimatorSpec(
        mode=self.mode,
        predictions=self.predictions,
        loss=self.loss,
        train_op=self.train_op,
        eval_metric_ops=eval_metric_ops,
        export_outputs=self.export_outputs,
        scaffold=scaffold,
        training_hooks=self.training_hooks + hooks,
        evaluation_hooks=self.evaluation_hooks + hooks,
        prediction_hooks=self.prediction_hooks + hooks)
Creates an equivalent `EstimatorSpec` used by CPU train/eval.
Creates an equivalent `EstimatorSpec` used by CPU train/eval.
Creates an equivalent EstimatorSpec used by CPU train / eval .
def as_estimator_spec(self):
    """Creates an equivalent `EstimatorSpec` used by CPU train/eval."""
    host_calls = {}
    if self.eval_metrics is not None:
      host_calls['eval_metrics'] = self.eval_metrics
    if self.host_call is not None:
      host_calls['host_call'] = self.host_call
    host_call_ret = _OutfeedHostCall.create_cpu_hostcall(host_calls)
    eval_metric_ops = None
    if self.eval_metrics is not None:
      eval_metric_ops = host_call_ret['eval_metrics']
    hooks = None
    if self.host_call is not None:
      hooks = [_OutfeedHostCallHook(host_call_ret['host_call'])]
    if tensor_tracer.TensorTracer.is_enabled():
      tt = tensor_tracer.TensorTracer()
      tracing_calls = tt.trace_cpu(ops.get_default_graph())
      tracing_call_ret = _OutfeedHostCall.create_cpu_hostcall(tracing_calls)
      tracing_functions = tracing_call_ret.values()
      if tracing_functions:
        if hooks:
          hooks.extend([_OutfeedHostCallHook(tracing_functions)])
        else:
          hooks = [_OutfeedHostCallHook(tracing_functions)]
    hooks = tuple(hooks or [])
    scaffold = self.scaffold_fn() if self.scaffold_fn else None
    return model_fn_lib.EstimatorSpec(
        mode=self.mode,
        predictions=self.predictions,
        loss=self.loss,
        train_op=self.train_op,
        eval_metric_ops=eval_metric_ops,
        export_outputs=self.export_outputs,
        scaffold=scaffold,
        training_hooks=self.training_hooks + hooks,
        evaluation_hooks=self.evaluation_hooks + hooks,
        prediction_hooks=self.prediction_hooks + hooks)
def as_estimator_spec ( self ) : host_calls = { } if self . eval_metrics is not None : host_calls [ 'eval_metrics' ] = self . eval_metrics if self . host_call is not None : host_calls [ 'host_call' ] = self . host_call host_call_ret = _OutfeedHostCall . create_cpu_hostcall ( host_calls ) eval_metric_ops = None if self . eval_metrics is not None : eval_metric_ops = host_call_ret [ 'eval_metrics' ] hooks = None if self . host_call is not None : hooks = [ _OutfeedHostCallHook ( host_call_ret [ 'host_call' ] ) ] if tensor_tracer . TensorTracer . is_enabled ( ) : tt = tensor_tracer . TensorTracer ( ) tracing_calls = tt . trace_cpu ( ops . get_default_graph ( ) ) tracing_call_ret = _OutfeedHostCall . create_cpu_hostcall ( tracing_calls ) tracing_functions = tracing_call_ret . values ( ) if tracing_functions : if hooks : hooks . extend ( [ _OutfeedHostCallHook ( tracing_functions ) ] ) else : hooks = [ _OutfeedHostCallHook ( tracing_functions ) ] hooks = tuple ( hooks or [ ] ) scaffold = self . scaffold_fn ( ) if self . scaffold_fn else None return model_fn_lib . EstimatorSpec ( mode = self . mode , predictions = self . predictions , loss = self . loss , train_op = self . train_op , eval_metric_ops = eval_metric_ops , export_outputs = self . export_outputs , scaffold = scaffold , training_hooks = self . training_hooks + hooks , evaluation_hooks = self . evaluation_hooks + hooks , prediction_hooks = self . prediction_hooks + hooks )