prototype pipeline

This commit is contained in:
2022-12-09 23:11:15 +00:00
parent 9d98638980
commit f4145463ee
5 changed files with 144 additions and 12 deletions
+25
View File
@@ -0,0 +1,25 @@
import os
import sys
import numpy as np
class Accumulator():
def __init__(self):
self.dict = dict()
def update(self, dict):
for key in dict.keys():
if key in self.dict.keys():
self.dict[key].append(dict[key])
else:
self.dict[key] = [dict[key]]
def get(self):
result = dict()
for key in self.dict.keys():
result[key] = np.mean(self.dict[key])
return result
def reset(self):
self.dict = dict()