From dd90b19eeb7814328b764315b7233f2b2e3b2d2b Mon Sep 17 00:00:00 2001
From: MORITA Kazutaka <morita.kazutaka@gmail.com>
Date: Wed, 9 May 2018 00:29:12 +0900
Subject: [PATCH] add sanity check to input shape type (#469)

---
 nnvm/python/nnvm/compiler/build_module.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/nnvm/python/nnvm/compiler/build_module.py b/nnvm/python/nnvm/compiler/build_module.py
index 3080baf1d..86fa08ec1 100644
--- a/nnvm/python/nnvm/compiler/build_module.py
+++ b/nnvm/python/nnvm/compiler/build_module.py
@@ -241,6 +241,10 @@ def build(graph, target=None, shape=None, dtype="float32",
     shape = shape if shape else {}
     if not isinstance(shape, dict):
         raise TypeError("require shape to be dict")
+    for value in shape.values():
+        if not all(isinstance(x, int) for x in value):
+            raise TypeError("shape value must be int iterator")
+
     cfg = BuildConfig.current
     graph = graph if isinstance(graph, _graph.Graph) else _graph.create(graph)
     shape, dtype = _update_shape_dtype(shape, dtype, params)
-- 
GitLab