projects
/
mygpt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b6a9cc2
)
Fixed a bug when there are no squares.
author
Francois Fleuret
<francois@fleuret.org>
Sat, 30 Jul 2022 06:06:11 +0000
(08:06 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Sat, 30 Jul 2022 06:06:11 +0000
(08:06 +0200)
picoclvr.py
patch
|
blob
|
history
diff --git
a/picoclvr.py
b/picoclvr.py
index
8201f5d
..
3ecbf3a
100755
(executable)
--- 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()))
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)
s = all_properties(height, width, len(seen), square_i, square_j, square_c)