(self, predictions)
return predictions
Validates TPUEstimatorSpec.predictions dict.
Validates TPUEstimatorSpec.predictions dict.
Validates TPUEstimatorSpec . predictions dict .
def _verify_tpu_spec_predictions(self, predictions):
    """Validates TPUEstimatorSpec.predictions dict."""
    # TODO(xiejw): Adds validation for prediction dictionrary.
    # TODO(xiejw): Adds support for single tensor as predictions.
    if not isinstance(predictions, dict):
      raise TypeError('TPUEstimatorSpec.predictions must be dict of Tensors.')

    for (key, tensor) in predictions.items():
      if tensor.shape.dims[0].value is None:
        raise ValueError(
            'The tensor with key ({}) in TPUEstimatorSpec.predictions has '
            'dynamic shape (should be static). Tensor: {}'.format(key, tensor))
    return predictions
def _verify_tpu_spec_predictions ( self , predictions ) : # TODO(xiejw): Adds validation for prediction dictionrary. # TODO(xiejw): Adds support for single tensor as predictions. if not isinstance ( predictions , dict ) : raise TypeError ( 'TPUEstimatorSpec.predictions must be dict of Tensors.' ) for ( key , tensor ) in predictions . items ( ) : if tensor . shape . dims [ 0 ] . value is None : raise ValueError ( 'The tensor with key ({}) in TPUEstimatorSpec.predictions has ' 'dynamic shape (should be static). Tensor: {}' . format ( key , tensor ) ) return predictions