X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=test-svrt.py;h=ad3677a97e69d181a25d7035317e4c9085ad5ad2;hb=d51ea9a85317ae2de673b107318970ac5ed5d6b9;hp=9aa2d594aeea21288d91c3c4b809d34f02c5bb3a;hpb=24368498f3065e8a4be34c5e8e2b68f9d1220f7d;p=pysvrt.git
diff --git a/test-svrt.py b/test-svrt.py
index 9aa2d59..ad3677a 100755
--- a/test-svrt.py
+++ b/test-svrt.py
@@ -19,7 +19,7 @@
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with selector. If not, see .
+# along with svrt. If not, see .
import time
@@ -34,17 +34,19 @@ from torch.nn import functional as fn
from torchvision import datasets, transforms, utils
-from _ext import svrt
+import svrt
labels = torch.LongTensor(12).zero_()
labels.narrow(0, 0, labels.size(0)//2).fill_(1)
-train_set = svrt.generate_vignettes(4, labels)
+x = svrt.generate_vignettes(4, labels)
-print(str(type(train_set)), train_set.size())
+print('compression factor {:f}'.format(x.storage().size() / svrt.compress(x.storage()).size()))
-train_set = train_set.view(train_set.size(0), 1, train_set.size(1), train_set.size(2))
+x = x.view(x.size(0), 1, x.size(1), x.size(2))
-train_set.div_(255)
+x.div_(255)
-torchvision.utils.save_image(train_set, 'example.png')
+torchvision.utils.save_image(x, 'example.png')
+
+print('Wrote example.png')