(self, h, stage, h_mol)
| 286 | return hazards, survival, Y_hat |
| 287 | |
| 288 | def forward(self, h, stage, h_mol): |
| 289 | |
| 290 | # H&E embedding. |
| 291 | h = self.compression_layer(h) |
| 292 | |
| 293 | # Attention MIL and first-order pooling. |
| 294 | A_raw, A = self.forward_attention(h) # 1xN tiles |
| 295 | h_hist = A @ h #torch.Size([1, dim_embedding]) [Sum over N(aihi,1), ..., Sum over N(aihi,dim_embedding)] |
| 296 | |
| 297 | # Stage learnable embedding. |
| 298 | stage = self.encoding_stage_net(stage) |
| 299 | |
| 300 | # Compression h_mol. |
| 301 | h_mol = self.encoding_mol_net(h_mol) |
| 302 | |
| 303 | # Attention gates on each modality. |
| 304 | h_hist, stage, h_mol = self.attn_modalities(h_hist, stage, h_mol) |
| 305 | |
| 306 | # Post-compressiong H&E slide embedding. |
| 307 | h_hist = self.post_compression_layer_he(h_hist) |
| 308 | |
| 309 | # Fusion. |
| 310 | m = self.forward_fusion(h_hist, stage, h_mol) |
| 311 | |
| 312 | # Post-compression of multimodal embedding. |
| 313 | m = self.post_compression_layer(m) |
| 314 | |
| 315 | # Survival head. |
| 316 | logits = self.classifier(m) |
| 317 | |
| 318 | hazards, survival, Y_hat = self.forward_survival(logits) |
| 319 | |
| 320 | return hazards, survival, Y_hat, A_raw, m |
nothing calls this directly
no test coverage detected