tf.estimator.EstimatorSpec
    
    
      
    
    
      
      Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
      
    
  
  
  
  
  
    
  
  
    
    
Ops and objects returned from a model_fn and passed to an Estimator.
tf.estimator.EstimatorSpec(
    mode,
    predictions=None,
    loss=None,
    train_op=None,
    eval_metric_ops=None,
    export_outputs=None,
    training_chief_hooks=None,
    training_hooks=None,
    scaffold=None,
    evaluation_hooks=None,
    prediction_hooks=None
)
EstimatorSpec fully defines the model to be run by an Estimator.
| Args | 
|---|
| mode | A ModeKeys. Specifies if this is training, evaluation or
prediction. | 
| predictions | Predictions Tensoror dict ofTensor. | 
| loss | Training loss Tensor. Must be either scalar, or with shape[1]. | 
| train_op | Op for the training step. | 
| eval_metric_ops | Dict of metric results keyed by name.
The values of the dict can be one of the following: (1) instance of Metricclass. (2) Results of calling a metric function, namely a(metric_tensor, update_op)tuple.metric_tensorshould be
  evaluated without any impact on state (typically is a pure computation
  results based on variables.). For example, it should not trigger theupdate_opor requires any input fetching. | 
| export_outputs | Describes the output signatures to be exported to SavedModeland used during serving.
A dict{name: output}where:
name: An arbitrary name for this output.output: an ExportOutputobject such asClassificationOutput,RegressionOutput, orPredictOutput. Single-headed models only need
to specify one entry in this dictionary. Multi-headed models should
specify one entry for each head, one of which must be named usingtf.saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY.
If no entry is provided, a defaultPredictOutputmapping topredictionswill be created. | 
| training_chief_hooks | Iterable of tf.train.SessionRunHookobjects to run
on the chief worker during training. | 
| training_hooks | Iterable of tf.train.SessionRunHookobjects to run on
all workers during training. | 
| scaffold | A tf.train.Scaffoldobject that can be used to set
initialization, saver, and more to be used in training. | 
| evaluation_hooks | Iterable of tf.train.SessionRunHookobjects to run
during evaluation. | 
| prediction_hooks | Iterable of tf.train.SessionRunHookobjects to run
during predictions. | 
| Raises | 
|---|
| ValueError | If validation fails. | 
| TypeError | If any of the arguments is not the expected type. | 
| Attributes | 
|---|
| mode | A namedtuplealias for field number 0 | 
| predictions | A namedtuplealias for field number 1 | 
| loss | A namedtuplealias for field number 2 | 
| train_op | A namedtuplealias for field number 3 | 
| eval_metric_ops | A namedtuplealias for field number 4 | 
| export_outputs | A namedtuplealias for field number 5 | 
| training_chief_hooks | A namedtuplealias for field number 6 | 
| training_hooks | A namedtuplealias for field number 7 | 
| scaffold | A namedtuplealias for field number 8 | 
| evaluation_hooks | A namedtuplealias for field number 9 | 
| prediction_hooks | A namedtuplealias for field number 10 | 
  
  
 
  
    
    
      
       
    
    
  
  
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
  Last updated 2022-10-27 UTC.
  
  
  
    
      [null,null,["Last updated 2022-10-27 UTC."],[],[]]