Represents the output of a generic prediction head. A generic prediction need not be either a classification or a regression. Named outputs must be provided as a dict from string to `Tensor`,
| 200 | |
| 201 | |
| 202 | class PredictOutput(ExportOutput): |
| 203 | """Represents the output of a generic prediction head. |
| 204 | |
| 205 | A generic prediction need not be either a classification or a regression. |
| 206 | |
| 207 | Named outputs must be provided as a dict from string to `Tensor`, |
| 208 | """ |
| 209 | _SINGLE_OUTPUT_DEFAULT_NAME = 'output' |
| 210 | |
| 211 | def __init__(self, outputs): |
| 212 | """Constructor for PredictOutput. |
| 213 | |
| 214 | Args: |
| 215 | outputs: A `Tensor` or a dict of string to `Tensor` representing the |
| 216 | predictions. |
| 217 | |
| 218 | Raises: |
| 219 | ValueError: if the outputs is not dict, or any of its keys are not |
| 220 | strings, or any of its values are not `Tensor`s. |
| 221 | """ |
| 222 | |
| 223 | self._outputs = self._wrap_and_check_outputs( |
| 224 | outputs, self._SINGLE_OUTPUT_DEFAULT_NAME, error_label='Prediction') |
| 225 | |
| 226 | @property |
| 227 | def outputs(self): |
| 228 | return self._outputs |
| 229 | |
| 230 | def as_signature_def(self, receiver_tensors): |
| 231 | return signature_def_utils.predict_signature_def(receiver_tensors, |
| 232 | self.outputs) |
| 233 | |
| 234 | |
| 235 | class _SupervisedOutput(ExportOutput): |