+ result = torch.ByteTensor(nb_channels,
+ gap + nb_sequences * (height + gap),
+ gap + nb_images_per_sequences * (width + gap))
+
+ result[0].fill_(gap_color[0])
+ result[1].fill_(gap_color[1])
+ result[2].fill_(gap_color[2])
+
+ for s in range(0, nb_sequences):
+ for i in range(0, nb_images_per_sequences):
+ result.narrow(1, gap + s * (height + gap), height).narrow(2, gap + i * (width + gap), width).copy_(x[s][i])
+
+ result_numpy = result.cpu().byte().transpose(0, 2).transpose(0, 1).numpy()
+
+ return Image.fromarray(result_numpy, 'RGB')
+
+######################################################################
+
+x = flatland.generate_sequence(5, 3, 128, 96)
+
+sequences_to_image(x).save('sequences.png')