projects
/
picoclvr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
559a50b
)
Update.
author
François Fleuret
<francois@fleuret.org>
Sun, 22 Oct 2023 15:08:29 +0000
(17:08 +0200)
committer
François Fleuret
<francois@fleuret.org>
Sun, 22 Oct 2023 15:08:29 +0000
(17:08 +0200)
problems.py
patch
|
blob
|
history
diff --git
a/problems.py
b/problems.py
index
51e90ed
..
675a47a
100755
(executable)
--- a/
problems.py
+++ b/
problems.py
@@
-308,7
+308,7
@@
class ProblemMixing(Problem):
x = x.flatten(1)
u = torch.arange(self.height * self.width).reshape(1, -1)
m = ((x - u).abs() == 0).long()
x = x.flatten(1)
u = torch.arange(self.height * self.width).reshape(1, -1)
m = ((x - u).abs() == 0).long()
- d = (x - (m * u + (1
-
m) * self.height * self.width)).abs().sum(-1) + (
+ d = (x - (m * u + (1
-
m) * self.height * self.width)).abs().sum(-1) + (
m.sum(dim=-1) != self.height * self.width // 2
).long()
return d
m.sum(dim=-1) != self.height * self.width // 2
).long()
return d
@@
-386,7
+386,7
@@
class ProblemMixing(Problem):
####################
if __name__ == "__main__":
####################
if __name__ == "__main__":
- p = ProblemMixing(
width=4, hard=True
)
+ p = ProblemMixing()
s, m = p.generate_sequences(10000)
for x in s[:5]:
print(p.seq2str(x))
s, m = p.generate_sequences(10000)
for x in s[:5]:
print(p.seq2str(x))