From 319d9f18ce2e116eafcdb352ab46d03052ab8c57 Mon Sep 17 00:00:00 2001 From: MORITA Kazutaka Date: Wed, 9 May 2018 00:29:12 +0900 Subject: [PATCH] add sanity check to input shape type (#469) --- python/nnvm/compiler/build_module.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/nnvm/compiler/build_module.py b/python/nnvm/compiler/build_module.py index 3080baf1d..86fa08ec1 100644 --- a/python/nnvm/compiler/build_module.py +++ b/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)