MCPcopy
hub / github.com/yerfor/GeneFacePlusPlus / append

Method append

modules/eg3ds/metrics/metric_utils.py:126–141  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

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

Callers 15

append_torchMethod · 0.95
update_extra_stateMethod · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
forwardMethod · 0.80
__init__Method · 0.80
forwardMethod · 0.80

Calls 1

set_num_featuresMethod · 0.95

Tested by

no test coverage detected