(self, inputs)
| 56 | self.eval() |
| 57 | |
| 58 | def forward(self, inputs): |
| 59 | assert isinstance(inputs, torch.Tensor) and list(inputs.shape[2:]) == [27, 48, 3] and inputs.dtype == torch.uint8, \ |
| 60 | "incorrect input type and/or shape" |
| 61 | # uint8 of shape [B, T, H, W, 3] to float of shape [B, 3, T, H, W] |
| 62 | x = inputs.permute([0, 4, 1, 2, 3]).float() |
| 63 | x = x.div_(255.) |
| 64 | |
| 65 | block_features = [] |
| 66 | for block in self.SDDCNN: |
| 67 | x = block(x) |
| 68 | block_features.append(x) |
| 69 | |
| 70 | if self.use_mean_pooling: |
| 71 | x = torch.mean(x, dim=[3, 4]) |
| 72 | x = x.permute(0, 2, 1) |
| 73 | else: |
| 74 | x = x.permute(0, 2, 3, 4, 1) |
| 75 | x = x.reshape(x.shape[0], x.shape[1], -1) |
| 76 | |
| 77 | if self.frame_sim_layer is not None: |
| 78 | x = torch.cat([self.frame_sim_layer(block_features), x], 2) |
| 79 | |
| 80 | if self.color_hist_layer is not None: |
| 81 | x = torch.cat([self.color_hist_layer(inputs), x], 2) |
| 82 | |
| 83 | x = self.fc1(x) |
| 84 | x = functional.relu(x) |
| 85 | |
| 86 | if self.dropout is not None: |
| 87 | x = self.dropout(x) |
| 88 | |
| 89 | one_hot = self.cls_layer1(x) |
| 90 | |
| 91 | if self.cls_layer2 is not None: |
| 92 | return one_hot, {"many_hot": self.cls_layer2(x)} |
| 93 | |
| 94 | return one_hot |
| 95 | |
| 96 | |
| 97 | class StackedDDCNNV2(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected