(self, inputs)
| 196 | ) |
| 197 | |
| 198 | def forward(self, inputs): |
| 199 | assert ( |
| 200 | len(inputs) == self.num_pathways |
| 201 | ), "Input tensor does not contain {} pathway".format(self.num_pathways) |
| 202 | pool_out = [] |
| 203 | for pathway in range(self.num_pathways): |
| 204 | m = getattr(self, "pathway{}_avgpool".format(pathway)) |
| 205 | pool_out.append(m(inputs[pathway])) |
| 206 | x = torch.cat(pool_out, 1) |
| 207 | # (N, C, T, H, W) -> (N, T, H, W, C). |
| 208 | x = x.permute((0, 2, 3, 4, 1)) |
| 209 | # Perform dropout. |
| 210 | if hasattr(self, "dropout"): |
| 211 | x = self.dropout(x) |
| 212 | x = self.projection(x) |
| 213 | |
| 214 | # Performs fully convlutional inference. |
| 215 | if not self.training: |
| 216 | x = self.act(x) |
| 217 | x = x.mean([1, 2, 3]) |
| 218 | |
| 219 | x = x.view(x.shape[0], -1) |
| 220 | return x |
| 221 | |
| 222 | |
| 223 | class X3DHead(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected