def save(self):
if self.index is None:
self.index = np.array(range(self.X.shape[0]))
metadata = {
"index": self.index.tolist(),
"x_shape": self.X.shape,
"x_type": str(self.X.dtype),
"running_mean": self.running_mean.tolist(),
"running_dev": self.running_dev.tolist(),
"running_min": self.running_min.tolist(),
"running_max": self.running_max.tolist(),
}
if self.Y is not None:
metadata["y_shape"] = self.Y.shape
metadata["y_type"] = str(self.Y.dtype)
with open(self.path+"/dataset.json", "wt") as f:
f.write(json.dumps(metadata))
self.X.flush()
if self.Y is not None: self.Y.flush()
评论列表
文章目录