+ result = self.test_input[:100].clone()
+ ar_mask = (
+ torch.arange(result.size(1), device=result.device)
+ > self.height * self.width + 2
+ ).long()[None, :]
+ ar_mask = ar_mask.expand_as(result)
+ result *= 1 - ar_mask # paraaaaanoiaaaaaaa
+
+ masked_inplace_autoregression(
+ model,
+ self.batch_size,
+ result,
+ ar_mask,
+ deterministic_synthesis,
+ device=self.device,
+ )
+
+ s, a, r = escape.seq2episodes(result, self.height, self.width)
+ str = escape.episodes2str(s, a, r, unicode=True, ansi_colors=True)
+
+ filename = os.path.join(result_dir, f"test_seq_{n_epoch:04d}.txt")
+ with open(filename, "w") as f:
+ f.write(str)
+ logger(f"wrote {filename}")