Open opensourcedigest opened 4 years ago
将代码:
def get_batch(self, batch_size): # 从数据集中随机取出batch_size个元素并返回 index = np.random.randint(0, np.shape(self.train_data)[0], batch_size) return self.train_data[index, :], self.train_label[index]
改为:
def get_batch(self, batch_size): # 从数据集中随机取出batch_size个元素并返回 # index = np.random.randint(0, np.shape(self.train_data)[0], batch_size) index = np.random.choice(np.shape(self.train_data)[0], batch_size, replace=False) return self.train_data[index, :], self.train_label[index]
可避免每次获取的数据中不存在重复项。
Thank you for the suggestion, could you please kindly submit a Pull Request to fix that?
Appreciate!
将代码:
改为:
可避免每次获取的数据中不存在重复项。