MCPcopy
hub / github.com/SizheAn/PanoHead / append

Method append

metrics/metric_utils.py:98–113  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

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

Callers 15

append_torchMethod · 0.95
gen_interp_videoFunction · 0.80
parse_rangeFunction · 0.80
convert_datasetFunction · 0.80
parse_rangeFunction · 0.80
open_cifar10Function · 0.80
convert_datasetFunction · 0.80
gen_interp_videoFunction · 0.80
parse_rangeFunction · 0.80
parse_rangeFunction · 0.80
generate_imagesFunction · 0.80

Calls 1

set_num_featuresMethod · 0.95

Tested by

no test coverage detected