不多说 上代码解释
self.train_x_set = self.train_x_set / 255.
mean = 0
std = 0
for x in self.train_x_set:
mean += np.mean(x[0, :, :])
mean /= len(self.train_x_set)
self.train_x_set -= mean
for x in self.train_x_set:
std += np.mean(np.square(x[0, :, :]).flatten())
std = np.sqrt(std / len(self.train_x_set))