(self, x)
| 311 | return x.reshape(batchsize, -1, *x.shape[1:]) |
| 312 | |
| 313 | def score(self, x): |
| 314 | was_numpy = False |
| 315 | if isinstance(x, np.ndarray): |
| 316 | was_numpy = True |
| 317 | x = torch.from_numpy(x) |
| 318 | while x.ndim > 1: |
| 319 | x = torch.max(x, dim=-1).values |
| 320 | if was_numpy: |
| 321 | return x.numpy() |
| 322 | return x |