dataset = dataset.batch(1)
// initialize inputs and outputs
seqs_1hot = []
targets = []
// collect inputs and outputs
for seq1_1hot, targets1 in dataset:
if return_inputs:
seqs_1hot.append(seq1_1hot)
if return_outputs:
targets.append(targets1)
// make arrays
After Change
// initialize inputs and outputs: this speeds it up insanely!
seqs_1hot = np.zeros((self.num_seqs, self.seq_length, self.seq_depth))
targets = np.zeros((self.num_seqs, self.target_length, self.num_targets))
counter = 0
// collect inputs and outputs
for seq1_1hot, targets1 in dataset:
//print(seq1_1hot.shape, targets1.shape)
if return_inputs:
seqs_1hot[counter,:,:] = seq1_1hot[0,:,:]
if return_outputs:
targets[counter,:,:] = targets1[0,:,:]
counter += 1
assert(counter == self.num_seqs)