Compute and return the accumulated rce.
(self)
| 167 | ) |
| 168 | |
| 169 | def compute(self) -> torch.Tensor: |
| 170 | """ |
| 171 | Compute and return the accumulated rce. |
| 172 | """ |
| 173 | baseline_mean = self.mean_label.compute() |
| 174 | |
| 175 | baseline_ce = _binary_cross_entropy_with_clipping( |
| 176 | baseline_mean, baseline_mean, reduction="mean", epsilon=self.epsilon |
| 177 | ) |
| 178 | |
| 179 | pred_ce = self.binary_cross_entropy.compute() |
| 180 | |
| 181 | return (1.0 - (pred_ce / baseline_ce)) * 100 |
| 182 | |
| 183 | def reset(self): |
| 184 | """ |