+ 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')
+
+######################################################################
+
+from _ext import flatland
+
+x = torch.ByteTensor()
+
+flatland.generate_sequence(10, x)
+
+sequences_to_image(x).save('sequences.png')