Constructs a postprocessor.
(self)
| 53 | """ |
| 54 | |
| 55 | def __init__(self): |
| 56 | """Constructs a postprocessor.""" |
| 57 | super(Postprocessor, self).__init__() |
| 58 | # Create empty matrix, for user's state_dict to load |
| 59 | self.pca_eigen_vectors = torch.empty( |
| 60 | (vggish_params.EMBEDDING_SIZE, vggish_params.EMBEDDING_SIZE,), |
| 61 | dtype=torch.float, |
| 62 | ) |
| 63 | self.pca_means = torch.empty( |
| 64 | (vggish_params.EMBEDDING_SIZE, 1), dtype=torch.float |
| 65 | ) |
| 66 | |
| 67 | self.pca_eigen_vectors = nn.Parameter(self.pca_eigen_vectors, requires_grad=False) |
| 68 | self.pca_means = nn.Parameter(self.pca_means, requires_grad=False) |
| 69 | |
| 70 | def postprocess(self, embeddings_batch): |
| 71 | """Applies tensor postprocessing to a batch of embeddings. |