(self, new_stats: "MaskData")
| 59 | raise TypeError(f"MaskData key {k} has an unsupported type {type(v)}.") |
| 60 | |
| 61 | def cat(self, new_stats: "MaskData") -> None: |
| 62 | for k, v in new_stats.items(): |
| 63 | if k not in self._stats or self._stats[k] is None: |
| 64 | self._stats[k] = deepcopy(v) |
| 65 | elif isinstance(v, torch.Tensor): |
| 66 | self._stats[k] = torch.cat([self._stats[k], v], dim=0) |
| 67 | elif isinstance(v, np.ndarray): |
| 68 | self._stats[k] = np.concatenate([self._stats[k], v], axis=0) |
| 69 | elif isinstance(v, list): |
| 70 | self._stats[k] = self._stats[k] + deepcopy(v) |
| 71 | else: |
| 72 | raise TypeError(f"MaskData key {k} has an unsupported type {type(v)}.") |
| 73 | |
| 74 | def to_numpy(self) -> None: |
| 75 | for k, v in self._stats.items(): |
no test coverage detected