Update.
[culture.git] / world.py
index 1d86bc6..ab02c82 100755 (executable)
--- a/world.py
+++ b/world.py
@@ -27,9 +27,9 @@ colors = torch.tensor(
 )
 
 token_background = 0
 )
 
 token_background = 0
-first_fish_token = 1
-nb_fish_tokens = len(colors) - 1
-token_forward = first_fish_token + nb_fish_tokens
+first_bird_token = 1
+nb_bird_tokens = len(colors) - 1
+token_forward = first_bird_token + nb_bird_tokens
 token_backward = token_forward + 1
 
 token2char = "_" + "".join([str(n) for n in range(len(colors) - 1)]) + "><"
 token_backward = token_forward + 1
 
 token2char = "_" + "".join([str(n) for n in range(len(colors) - 1)]) + "><"
@@ -49,9 +49,9 @@ def generate(
         f_end = torch.zeros(height, width, dtype=torch.int64)
         n = torch.arange(f_start.size(0))
 
         f_end = torch.zeros(height, width, dtype=torch.int64)
         n = torch.arange(f_start.size(0))
 
-        nb_fish = torch.randint(max_nb_obj, (1,)).item() + 1
+        nb_birds = torch.randint(max_nb_obj, (1,)).item() + 1
         for c in (
         for c in (
-            (torch.randperm(nb_fish_tokens) + first_fish_token)[:nb_fish].sort().values
+            (torch.randperm(nb_bird_tokens) + first_bird_token)[:nb_birds].sort().values
         ):
             i, j = (
                 torch.randint(height - 2, (1,))[0] + 1,
         ):
             i, j = (
                 torch.randint(height - 2, (1,))[0] + 1,
@@ -109,7 +109,7 @@ def sample2img(seq, height, width, upscale=15):
 
     def mosaic(x, upscale):
         x = x.reshape(-1, height, width)
 
     def mosaic(x, upscale):
         x = x.reshape(-1, height, width)
-        m = torch.logical_and(x >= 0, x < first_fish_token + nb_fish_tokens).long()
+        m = torch.logical_and(x >= 0, x < first_bird_token + nb_bird_tokens).long()
         x = colors[x * m].permute(0, 3, 1, 2)
         s = x.shape
         x = x[:, :, :, None, :, None].expand(-1, -1, -1, upscale, -1, upscale)
         x = colors[x * m].permute(0, 3, 1, 2)
         s = x.shape
         x = x[:, :, :, None, :, None].expand(-1, -1, -1, upscale, -1, upscale)