(self, x)
| 85 | return (self.max_items is not None) and (self.num_items >= self.max_items) |
| 86 | |
| 87 | def append(self, x): |
| 88 | x = np.asarray(x, dtype=np.float32) |
| 89 | assert x.ndim == 2 |
| 90 | if (self.max_items is not None) and (self.num_items + x.shape[0] > self.max_items): |
| 91 | if self.num_items >= self.max_items: |
| 92 | return |
| 93 | x = x[:self.max_items - self.num_items] |
| 94 | |
| 95 | self.set_num_features(x.shape[1]) |
| 96 | self.num_items += x.shape[0] |
| 97 | if self.capture_all: |
| 98 | self.all_features.append(x) |
| 99 | if self.capture_mean_cov: |
| 100 | x64 = x.astype(np.float64) |
| 101 | self.raw_mean += x64.sum(axis=0) |
| 102 | self.raw_cov += x64.T @ x64 |
| 103 | |
| 104 | def append_torch(self, x, num_gpus=1, rank=0): |
| 105 | assert isinstance(x, torch.Tensor) and x.ndim == 2 |
no test coverage detected