From 029bb41b55d4cb756e01d3b176f6bc96add05c39 Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Mon, 26 Aug 2019 12:25:34 +0200
Subject: [PATCH] [bob-devel] More tests for pytorch

---
 conda/beat-devel/meta.yaml  |  4 ++--
 conda/bob-devel/meta.yaml   |  6 +++---
 conda/bob-devel/run_test.py | 19 +++++++++++++++++++
 3 files changed, 24 insertions(+), 5 deletions(-)
 create mode 100644 conda/bob-devel/run_test.py

diff --git a/conda/beat-devel/meta.yaml b/conda/beat-devel/meta.yaml
index dfd3ea3c..ad9b6914 100644
--- a/conda/beat-devel/meta.yaml
+++ b/conda/beat-devel/meta.yaml
@@ -2,7 +2,7 @@
 {% set nopin = ['ca-certificates', 'certifi', 'openssl', 'libstdcxx-ng', 'libgcc-ng', 'libcxx', 'libcxxabi'] %}
 package:
   name: beat-devel
-  version: 2019.08.14
+  version: 2019.08.26
 
 build:
   # the build number must be zero all the time.
@@ -15,7 +15,7 @@ build:
 requirements:
   host:
     - python {{ python }}
-    - bob-devel 2019.08.14
+    - bob-devel 2019.08.26
     - docker-py 4.0.2
     - flask 1.0.2
     - flask-cors 3.0.7
diff --git a/conda/bob-devel/meta.yaml b/conda/bob-devel/meta.yaml
index c64c1bb2..0eec1f79 100644
--- a/conda/bob-devel/meta.yaml
+++ b/conda/bob-devel/meta.yaml
@@ -4,7 +4,7 @@ package:
   name: bob-devel
   # please update the version of beat-devel and update bob-devel's version
   # there as well in the same merge request.
-  version: 2019.08.14
+  version: 2019.08.26
 
 build:
   # the build number must be zero all the time.
@@ -94,11 +94,11 @@ requirements:
   {% endfor %}
 
 test:
-  imports:
-    - torch  # [linux]
   requires:
+    - numpy
     - ffmpeg
     - pytorch  # [linux]
+    - torchvision  # [linux]
   commands:
     # we expect these features from ffmpeg:
     - ffmpeg -codecs | grep "DEVI.S zlib"  # [unix]
diff --git a/conda/bob-devel/run_test.py b/conda/bob-devel/run_test.py
new file mode 100644
index 00000000..a09d245e
--- /dev/null
+++ b/conda/bob-devel/run_test.py
@@ -0,0 +1,19 @@
+import sys
+
+# couple of imports to see if packages are working
+import numpy
+
+
+def test_pytorch():
+    import torch
+    from torchvision.models import DenseNet
+
+    model = DenseNet()
+    t = torch.randn(1, 3, 224, 224)
+    out = model(t)
+    assert out.shape[1] == 1000
+
+
+if sys.platform.startswith("linux"):
+    # test if pytorch installation is sane
+    test_pytorch()
-- 
GitLab