(cls,
              mode,
              predictions=None,
              loss=None,
              train_op=None,
              eval_metrics=None,
              export_outputs=None,
              scaffold_fn=None,
              host_call=None,
              training_hooks=None,
              evaluation_hooks=None,
              prediction_hooks=None)
return super(TPUEstimatorSpec, cls).__new__(
        cls,
        mode=mode,
        predictions=predictions,
        loss=loss,
        train_op=train_op,
        eval_metrics=eval_metrics,
        export_outputs=export_outputs,
        scaffold_fn=scaffold_fn,
        host_call=host_call,
        training_hooks=training_hooks,
        evaluation_hooks=evaluation_hooks,
        prediction_hooks=prediction_hooks)
Creates a validated `TPUEstimatorSpec` instance.
Creates a validated `TPUEstimatorSpec` instance.
Creates a validated TPUEstimatorSpec instance .
def __new__(cls,
              mode,
              predictions=None,
              loss=None,
              train_op=None,
              eval_metrics=None,
              export_outputs=None,
              scaffold_fn=None,
              host_call=None,
              training_hooks=None,
              evaluation_hooks=None,
              prediction_hooks=None):
    """Creates a validated `TPUEstimatorSpec` instance."""
    host_calls = {}
    if eval_metrics is not None:
      host_calls['eval_metrics'] = eval_metrics
    if host_call is not None:
      host_calls['host_call'] = host_call
    _OutfeedHostCall.validate(host_calls)

    training_hooks = tuple(training_hooks or [])
    evaluation_hooks = tuple(evaluation_hooks or [])
    prediction_hooks = tuple(prediction_hooks or [])

    for hook in training_hooks + evaluation_hooks + prediction_hooks:
      if not isinstance(hook, session_run_hook.SessionRunHook):
        raise TypeError('All hooks must be SessionRunHook instances, given: {}'
                        .format(hook))

    return super(TPUEstimatorSpec, cls).__new__(
        cls,
        mode=mode,
        predictions=predictions,
        loss=loss,
        train_op=train_op,
        eval_metrics=eval_metrics,
        export_outputs=export_outputs,
        scaffold_fn=scaffold_fn,
        host_call=host_call,
        training_hooks=training_hooks,
        evaluation_hooks=evaluation_hooks,
        prediction_hooks=prediction_hooks)
def __new__ ( cls , mode , predictions = None , loss = None , train_op = None , eval_metrics = None , export_outputs = None , scaffold_fn = None , host_call = None , training_hooks = None , evaluation_hooks = None , prediction_hooks = None ) : host_calls = { } if eval_metrics is not None : host_calls [ 'eval_metrics' ] = eval_metrics if host_call is not None : host_calls [ 'host_call' ] = host_call _OutfeedHostCall . validate ( host_calls ) training_hooks = tuple ( training_hooks or [ ] ) evaluation_hooks = tuple ( evaluation_hooks or [ ] ) prediction_hooks = tuple ( prediction_hooks or [ ] ) for hook in training_hooks + evaluation_hooks + prediction_hooks : if not isinstance ( hook , session_run_hook . SessionRunHook ) : raise TypeError ( 'All hooks must be SessionRunHook instances, given: {}' . format ( hook ) ) return super ( TPUEstimatorSpec , cls ) . __new__ ( cls , mode = mode , predictions = predictions , loss = loss , train_op = train_op , eval_metrics = eval_metrics , export_outputs = export_outputs , scaffold_fn = scaffold_fn , host_call = host_call , training_hooks = training_hooks , evaluation_hooks = evaluation_hooks , prediction_hooks = prediction_hooks )