(self, x)
| 124 | return (self.max_items is not None) and (self.num_items >= self.max_items) |
| 125 | |
| 126 | def append(self, x): |
| 127 | x = np.asarray(x, dtype=np.float32) |
| 128 | assert x.ndim == 2 |
| 129 | if (self.max_items is not None) and (self.num_items + x.shape[0] > self.max_items): |
| 130 | if self.num_items >= self.max_items: |
| 131 | return |
| 132 | x = x[:self.max_items - self.num_items] |
| 133 | |
| 134 | self.set_num_features(x.shape[1]) |
| 135 | self.num_items += x.shape[0] |
| 136 | if self.capture_all: |
| 137 | self.all_features.append(x) |
| 138 | if self.capture_mean_cov: |
| 139 | x64 = x.astype(np.float64) |
| 140 | self.raw_mean += x64.sum(axis=0) |
| 141 | self.raw_cov += x64.T @ x64 |
| 142 | |
| 143 | def append_torch(self, x, num_gpus=1, rank=0): |
| 144 | assert isinstance(x, torch.Tensor) and x.ndim == 2 |
no test coverage detected