dataset.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:untwist 作者: IoSR-Surrey 项目源码 文件源码
def __init__(self, path,
        x_width = 0, x_type = np.float,
        y_width = 0, y_type = types.int_):

        if os.path.exists(path + "/dataset.json"):
            print("Using existing dataset in "+path)
            self.load(path)
        else:
            if x_width == 0 : raise "X width must be specified for new dataset"
            self.X = np.memmap(path + "/X.npy", x_type, "w+", 0, (1, x_width))
            self.X.flush()
            if y_width > 0:
                self.Y = np.memmap(path + "/Y.npy", y_type, "w+", 0, (1, y_width))
                self.Y.flush()
            else: self.Y = None
            self.index = None
            self.nrows = 0
            self.running_mean = np.zeros((1, x_width), x_type)
            self.running_dev = np.zeros((1, x_width), x_type)
            self.running_max = np.zeros((1, x_width), x_type)
            self.running_min = np.zeros((1, x_width), x_type)
            self.path = path
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号