'Applies postprocessing to a batch of embeddings.
Args:
embeddings_batch: An nparray of shape [batch_size, embedding_size]
containing output from the embedding layer of VGGish.
Returns:
An nparray of the same shape as the input but of type uint8,
containing the PCA-transformed and quantized version of the input.'

def postprocess(self, embeddings_batch):

    assert (len(embeddings_batch.shape) == 2), ('Expected    2-d    batch,    got    %r' % (embeddings_batch.shape,))
    assert (embeddings_batch.shape[1] == vggish_params.EMBEDDING_SIZE), ('Bad    batch    shape:    %r' % (embeddings_batch.shape,))
    pca_applied = np.dot(self._pca_matrix, (embeddings_batch.T - self._pca_means)).T
    clipped_embeddings = np.clip(pca_applied, vggish_params.QUANTIZE_MIN_VAL, vggish_params.QUANTIZE_MAX_VAL)
    quantized_embeddings = ((clipped_embeddings - vggish_params.QUANTIZE_MIN_VAL) * (255.0 / (vggish_params.QUANTIZE_MAX_VAL - vggish_params.QUANTIZE_MIN_VAL)))
    quantized_embeddings = quantized_embeddings.astype(np.uint8)
    return quantized_embeddings
