Forward pass. Args: x (list[Tensor]): Features from the backbone. Returns: Tuple[List[Tensor], ...]: Predictions of the head.
(self, x: List[Tensor], batch_size)
| 131 | nn.init.constant_(self.conv_cls.bias, bias_init_with_prob(.01)) |
| 132 | |
| 133 | def forward(self, x: List[Tensor], batch_size) -> Tuple[List[Tensor], ...]: |
| 134 | """Forward pass. |
| 135 | |
| 136 | Args: |
| 137 | x (list[Tensor]): Features from the backbone. |
| 138 | |
| 139 | Returns: |
| 140 | Tuple[List[Tensor], ...]: Predictions of the head. |
| 141 | """ |
| 142 | feats, cls_preds, points = [], [], [] |
| 143 | inputs = x |
| 144 | x = inputs[-1] |
| 145 | prune_score = None |
| 146 | for i in range(len(inputs) - 1, -1, -1): |
| 147 | if i < len(inputs) - 1: |
| 148 | x = self.__getattr__(f'up_block_{i + 1}')(x) |
| 149 | x = inputs[i] + x |
| 150 | x = self._prune(x, prune_score) |
| 151 | |
| 152 | out = self.__getattr__(f'out_block_{i}')(x) |
| 153 | feat, cls_pred, point, prune_score = \ |
| 154 | self._forward_single(out) |
| 155 | feats.append(feat) |
| 156 | cls_preds.append(cls_pred) |
| 157 | points.append(point) |
| 158 | batch_feats_list, batch_scores_list, batch_points_list = \ |
| 159 | self.convert_to_batch(feats, cls_preds, points, batch_size) |
| 160 | return batch_feats_list, batch_scores_list, batch_points_list |
| 161 | |
| 162 | def _prune(self, x: SparseTensor, scores: SparseTensor) -> SparseTensor: |
| 163 | """Prunes the tensor by score thresholding. |
nothing calls this directly
no test coverage detected