MCPcopy Create free account
hub / github.com/ElliotVincent/SitsSCD / validation_step

Method validation_step

models/module.py:32–37  ·  view source on GitHub ↗
(self, batch, batch_idx, dataloader_idx)

Source from the content-addressed store, hash-verified

30
31 @torch.no_grad()
32 def validation_step(self, batch, batch_idx, dataloader_idx):
33 pred = self.model(batch)
34 pred["pred"] = torch.argmax(pred["logits"], dim=2)
35 loss = self.loss(pred, batch, average=True)["loss"]
36 self.val_metrics[self.domain_dict[dataloader_idx]].update(pred["pred"], batch["gt"])
37 self.log("val/loss", loss, sync_dist=True, on_step=False, on_epoch=True)
38
39 def on_validation_epoch_end(self):
40 for dataloader_idx in ['out', 'in']:

Callers

nothing calls this directly

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected