projects
/
culture.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update.
[culture.git]
/
world.py
diff --git
a/world.py
b/world.py
index
12c6553
..
aad0bfb
100755
(executable)
--- a/
world.py
+++ b/
world.py
@@
-1,5
+1,10
@@
#!/usr/bin/env python
#!/usr/bin/env python
+# Any copyright is dedicated to the Public Domain.
+# https://creativecommons.org/publicdomain/zero/1.0/
+
+# Written by Francois Fleuret <francois@fleuret.org>
+
import math, sys, tqdm
import torch, torchvision
import math, sys, tqdm
import torch, torchvision
@@
-61,12
+66,13
@@
class SignSTE(nn.Module):
else:
return s
else:
return s
+
class DiscreteSampler2d(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
class DiscreteSampler2d(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
- s = (x >= x.max(-3,keepdim=True).values).float()
+ s = (x >= x.max(-3,
keepdim=True).values).float()
if self.training:
u = x.softmax(dim=-3)
if self.training:
u = x.softmax(dim=-3)
@@
-96,7
+102,6
@@
def train_encoder(
logger=None,
device=torch.device("cpu"),
):
logger=None,
device=torch.device("cpu"),
):
-
mu, std = train_input.float().mean(), train_input.float().std()
def encoder_core(depth, dim):
mu, std = train_input.float().mean(), train_input.float().std()
def encoder_core(depth, dim):
@@
-459,7
+464,8
@@
if __name__ == "__main__":
frame2seq,
seq2frame,
) = create_data_and_processors(
frame2seq,
seq2frame,
) = create_data_and_processors(
- 25000, 1000,
+ 25000,
+ 1000,
nb_epochs=5,
mode="first_last",
nb_steps=20,
nb_epochs=5,
mode="first_last",
nb_steps=20,