(self, x)
| 96 | return (self.max_items is not None) and (self.num_items >= self.max_items) |
| 97 | |
| 98 | def append(self, x): |
| 99 | x = np.asarray(x, dtype=np.float32) |
| 100 | assert x.ndim == 2 |
| 101 | if (self.max_items is not None) and (self.num_items + x.shape[0] > self.max_items): |
| 102 | if self.num_items >= self.max_items: |
| 103 | return |
| 104 | x = x[:self.max_items - self.num_items] |
| 105 | |
| 106 | self.set_num_features(x.shape[1]) |
| 107 | self.num_items += x.shape[0] |
| 108 | if self.capture_all: |
| 109 | self.all_features.append(x) |
| 110 | if self.capture_mean_cov: |
| 111 | x64 = x.astype(np.float64) |
| 112 | self.raw_mean += x64.sum(axis=0) |
| 113 | self.raw_cov += x64.T @ x64 |
| 114 | |
| 115 | def append_torch(self, x, num_gpus=1, rank=0): |
| 116 | assert isinstance(x, torch.Tensor) and x.ndim == 2 |
no test coverage detected