MCPcopy
hub / github.com/Vchitect/Latte / append

Method append

tools/metrics/metric_utils.py:87–102  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

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

Callers 15

append_torchMethod · 0.95
mainFunction · 0.80
training_stepMethod · 0.80
convert_videos_to_framesFunction · 0.80
random_frame_samplingFunction · 0.80
__init__Method · 0.80
_load_raw_framesMethod · 0.80
post_hookFunction · 0.80
import_hookFunction · 0.80
_syncFunction · 0.80
compute_isFunction · 0.80

Calls 1

set_num_featuresMethod · 0.95

Tested by

no test coverage detected