Ops and objects returned from a model_fn and passed to an Estimator.

Used in the notebooks

Used in the guide Used in the tutorials

EstimatorSpec fully defines the model to be run by an Estimator.

mode A ModeKeys. Specifies if this is training, evaluation or prediction.
predictions Predictions Tensor or dict of Tensor.
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 Metric class. (2) Results of calling a metric function, namely a (metric_tensor, update_op) tuple. metric_tensor should be evaluated without any impact on state (typically is a pure computation results based on variables.). For example, it should not trigger the update_op or requires any input fetching.
export_outputs Describes the output signatures to be exported to SavedModel and used during serving. A dict {name: output} where:

  • name: An arbitrary name for this output.
  • output: an ExportOutput object such as ClassificationOutput, RegressionOutput, or PredictOutput. 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 using tf.saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY. If no entry is provided, a default PredictOutput mapping to predictions will be created.