(self, batch)
| 80 | return {"reconstructions": reconstructions, "embedding": x} |
| 81 | |
| 82 | def training_step(self, batch): |
| 83 | # slice the input and copy |
| 84 | input = self.preprocess(batch["spectrum"]) |
| 85 | target = torch.clone(input) |
| 86 | |
| 87 | # mask parts of the input |
| 88 | input = self.mask_sequence(input) |
| 89 | # forward pass |
| 90 | output = self.forward_without_preprocessing(input)["reconstructions"] |
| 91 | |
| 92 | # find the mask locations |
| 93 | locs = (input != target).type_as(output) |
| 94 | loss = F.mse_loss(output * locs, target * locs, reduction="mean") / locs.mean() |
| 95 | self.log("training_loss", loss, prog_bar=True) |
| 96 | return loss |
| 97 | |
| 98 | def validation_step(self, batch): |
| 99 | # slice the input and copy |
nothing calls this directly
no test coverage detected