From: Francois Fleuret Date: Sat, 30 Jul 2022 06:06:11 +0000 (+0200) Subject: Fixed a bug when there are no squares. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=82ddf9ca322e6fcc8f9364a696c26d15841d13d8;p=mygpt.git Fixed a bug when there are no squares. --- diff --git a/picoclvr.py b/picoclvr.py index 8201f5d..3ecbf3a 100755 --- a/picoclvr.py +++ b/picoclvr.py @@ -173,9 +173,14 @@ def descr2properties(descr, height, width): seen[x] = (color_id[x], k // width, k % width) square_infos = tuple(zip(*seen.values())) - square_c = torch.tensor(square_infos[0]) - square_i = torch.tensor(square_infos[1]) - square_j = torch.tensor(square_infos[2]) + if square_infos: + square_c = torch.tensor(square_infos[0]) + square_i = torch.tensor(square_infos[1]) + square_j = torch.tensor(square_infos[2]) + else: + square_c = torch.tensor([]) + square_i = torch.tensor([]) + square_j = torch.tensor([]) s = all_properties(height, width, len(seen), square_i, square_j, square_c)