(self, refanchors: Tensor)
| 107 | [x_noise_scale, y_noise_scale, w_noise_scale, h_noise_scale]) |
| 108 | |
| 109 | def __call__(self, refanchors: Tensor) -> Tensor: |
| 110 | nq, bs, query_dim = refanchors.shape |
| 111 | device = refanchors.device |
| 112 | |
| 113 | noise_raw = torch.rand_like(refanchors) |
| 114 | noise_scale = self.noise_scale.to(device)[:query_dim] |
| 115 | |
| 116 | new_refanchors = refanchors * (1 + (noise_raw - 0.5) * noise_scale) |
| 117 | return new_refanchors.clamp_(0, 1) |
| 118 | |
| 119 | |
| 120 | def sigmoid_focal_loss(inputs, |