Update.
authorFrançois Fleuret <francois@fleuret.org>
Sat, 11 Mar 2023 23:08:44 +0000 (00:08 +0100)
committerFrançois Fleuret <francois@fleuret.org>
Sat, 11 Mar 2023 23:08:44 +0000 (00:08 +0100)
beaver.py

index a289867..c68fe76 100755 (executable)
--- a/beaver.py
+++ b/beaver.py
@@ -227,6 +227,7 @@ class TaskMaze(Task):
             result = input.clone()
             ar_mask = result.new_zeros(result.size())
             ar_mask[:, self.height * self.width :] = 1
+            result *= 1-ar_mask
             masked_inplace_autoregression(model, self.batch_size, result, ar_mask)
             mazes, paths = self.seq2map(result)
             nb_correct += maze.path_correctness(mazes, paths).long().sum()
@@ -256,8 +257,8 @@ class TaskMaze(Task):
             input = self.test_input[:32]
             result = input.clone()
             ar_mask = result.new_zeros(result.size())
-
             ar_mask[:, self.height * self.width :] = 1
+            result *= 1-ar_mask
             masked_inplace_autoregression(model, self.batch_size, result, ar_mask)
 
             mazes, paths = self.seq2map(input)