Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

Commit

Permalink
add sanity check to input shape type (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazum authored and tqchen committed May 8, 2018
1 parent 8c0a103 commit 319d9f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/nnvm/compiler/build_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 319d9f1

Please sign in to comment.