Commit dd90b19e by MORITA Kazutaka Committed by Tianqi Chen

add sanity check to input shape type (#469)

parent 42d81cca
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment