def next_batch(self):
    '\n        Read a batch randomly\n        :x_batch: <batch size x seq_length x input_dim>\n        :y_batch: <batch size x seq_length x input_dim>\n        :d_batch: <batch size x seq_length>\n        '
    x_batch = []
    y_batch = []
    sg_batch = []
    map_batch = []
    d_batch = []
    for i in range(self.batch_size):
        data = self.train_data[self.pointer]
        idx = random.randint(0, ((len(data) - self.seq_length) - 2))
        seq_all = np.copy(data[idx:((idx + self.seq_length) + 2)])
        (seq_all_proc, seq_sgrid, seq_map) = self.preprocess_sequence(seq_all, isValid=False, isDiff=True)
        seq_x = np.copy(seq_all_proc[0:self.seq_length])
        seq_y = np.copy(seq_all_proc[1:(self.seq_length + 1)])
        seq_sgrid_x = np.copy(seq_sgrid[0:self.seq_length, :])
        y_batch.append(seq_y)
        x_batch.append(seq_x)
        sg_batch.append(seq_sgrid_x)
        map_batch.append(seq_map[0:self.seq_length])
        d_batch.append([self.pointer, idx])
        ' \n            if len(data) is smaller than 50, self.seq_length is 24\n            n_batch is 1, therefore, (1.0 / n_batch) is 1\n            then the following is the same as\n            if random.random() < 1, then go next with prob. 1\n\n            if len(data) is greater than 50, self.seq_length is 24\n            n_batch is 2, therefore, (1.0 / n_batch) is 0.5\n            then the following is the same as\n            if random.random() < 0.5, then go next with prob. 0.5\n            '
        n_batch = int((len(data) / (self.seq_length + 2)))
        if (random.random() < (1.0 / float(n_batch))):
            self.tick_batch_pointer()
    return (x_batch, y_batch, sg_batch, map_batch, d_batch)
Read a batch randomly
:x_batch: <batch size x seq_length x input_dim>
:y_batch: <batch size x seq_length x input_dim>
:d_batch: <batch size x seq_length>
def next_batch(self):
    '\n        Read a batch randomly\n        :x_batch: <batch size x seq_length x input_dim>\n        :y_batch: <batch size x seq_length x input_dim>\n        :d_batch: <batch size x seq_length>\n        '
    x_batch = []
    y_batch = []
    sg_batch = []
    map_batch = []
    d_batch = []
    for i in range(self.batch_size):
        data = self.train_data[self.pointer]
        idx = random.randint(0, ((len(data) - self.seq_length) - 2))
        seq_all = np.copy(data[idx:((idx + self.seq_length) + 2)])
        (seq_all_proc, seq_sgrid, seq_map) = self.preprocess_sequence(seq_all, isValid=False, isDiff=True)
        seq_x = np.copy(seq_all_proc[0:self.seq_length])
        seq_y = np.copy(seq_all_proc[1:(self.seq_length + 1)])
        seq_sgrid_x = np.copy(seq_sgrid[0:self.seq_length, :])
        y_batch.append(seq_y)
        x_batch.append(seq_x)
        sg_batch.append(seq_sgrid_x)
        map_batch.append(seq_map[0:self.seq_length])
        d_batch.append([self.pointer, idx])
        ' \n            if len(data) is smaller than 50, self.seq_length is 24\n            n_batch is 1, therefore, (1.0 / n_batch) is 1\n            then the following is the same as\n            if random.random() < 1, then go next with prob. 1\n\n            if len(data) is greater than 50, self.seq_length is 24\n            n_batch is 2, therefore, (1.0 / n_batch) is 0.5\n            then the following is the same as\n            if random.random() < 0.5, then go next with prob. 0.5\n            '
        n_batch = int((len(data) / (self.seq_length + 2)))
        if (random.random() < (1.0 / float(n_batch))):
            self.tick_batch_pointer()
    return (x_batch, y_batch, sg_batch, map_batch, d_batch)