Decode the multi-resolution encodings.
(self, encodings: torch.Tensor)
| 72 | self.fusions = nn.ModuleList(fusions) |
| 73 | |
| 74 | def forward(self, encodings: torch.Tensor) -> torch.Tensor: |
| 75 | """Decode the multi-resolution encodings.""" |
| 76 | num_levels = len(encodings) |
| 77 | num_encoders = len(self.dims_encoder) |
| 78 | |
| 79 | if num_levels != num_encoders: |
| 80 | raise ValueError( |
| 81 | f"Got encoder output levels={num_levels}, expected levels={num_encoders+1}." |
| 82 | ) |
| 83 | |
| 84 | # Project features of different encoder dims to the same decoder dim. |
| 85 | # Fuse features from the lowest resolution (num_levels-1) |
| 86 | # to the highest (0). |
| 87 | features = self.convs[-1](encodings[-1]) |
| 88 | lowres_features = features |
| 89 | features = self.fusions[-1](features) |
| 90 | for i in range(num_levels - 2, -1, -1): |
| 91 | features_i = self.convs[i](encodings[i]) |
| 92 | features = self.fusions[i](features, features_i) |
| 93 | return features, lowres_features |
| 94 | |
| 95 | |
| 96 | class ResidualBlock(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected