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

add sanity check to input shape type #469

Merged
merged 1 commit into from
May 8, 2018
Merged

Conversation

kazum
Copy link
Member

@kazum kazum commented May 8, 2018

This PR adds a sanity check to the input shape type of nnvm.compiler.build.
Without this patch, the error message is confusing, especially to beginners.

>>> nnvm.compiler.build(compute_graph, target="cuda", shape={"x": None})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/kazutaka/git/nnvm/python/nnvm/compiler/build_module.py", line 257, in build
    ishape, _ = graph_util.infer_shape(graph, **shape)
  File "/Users/kazutaka/git/nnvm/python/nnvm/compiler/graph_util.py", line 30, in infer_shape
    graph = graph_attr.set_shape_inputs(graph, shape)
  File "/Users/kazutaka/git/nnvm/python/nnvm/compiler/graph_attr.py", line 25, in set_shape_inputs
    g._set_json_attr("shape_inputs", list_shape, 'list_shape')
  File "/Users/kazutaka/git/nnvm/python/nnvm/graph.py", line 165, in _set_json_attr
    self.handle, c_str(key), c_str(json_value)))
  File "/Users/kazutaka/git/nnvm/python/nnvm/_base.py", line 75, in check_call
    raise NNVMError(py_str(_LIB.NNGetLastError()))
nnvm._base.NNVMError: [10:10:36] /Users/kazutaka/git/nnvm/dmlc-core/include/dmlc/./json.h:738: Check failed: ch == '[' (110 vs. [) Error at Line 0, around ^`ull, []]]`, Expect '{' but get 'n'

Stack trace returned 10 entries:
[bt] (0) 0   libnnvm_compiler.dylib              0x0000000112a61edb dmlc::StackTrace() + 299
[bt] (1) 1   libnnvm_compiler.dylib              0x0000000112a61c6f dmlc::LogMessageFatal::~LogMessageFatal() + 47
[bt] (2) 2   libnnvm_compiler.dylib              0x0000000112b981a9 dmlc::JSONReader::BeginArray() + 505
[bt] (3) 3   libnnvm_compiler.dylib              0x0000000112bcefec nnvm::Tuple<long long>::Load(dmlc::JSONReader*) + 44
[bt] (4) 4   libnnvm_compiler.dylib              0x0000000112bceaa1 dmlc::json::ArrayHandler<std::__1::vector<nnvm::TShape, std::__1::allocator<nnvm::TShape> > >::Read(dmlc::JSONReader*, std::__1::vector<nnvm::TShape, std::__1::allocator<nnvm::TShape> >*) + 129
[bt] (5) 5   libnnvm_compiler.dylib              0x0000000112bce844 void dmlc::json::AnyJSONManager::ReadAny<std::__1::vector<nnvm::TShape, std::__1::allocator<nnvm::TShape> > >(dmlc::JSONReader*, dmlc::any*) + 52
[bt] (6) 6   libnnvm_compiler.dylib              0x0000000112b97e70 dmlc::json::Handler<dmlc::any>::Read(dmlc::JSONReader*, dmlc::any*) + 848
[bt] (7) 7   libnnvm_compiler.dylib              0x0000000112b96753 NNGraphSetJSONAttr + 483
[bt] (8) 8   _ctypes.so                          0x000000010d15c837 ffi_call_unix64 + 79
[bt] (9) 9   ???                                 0x00007fff52e1e570 0x0 + 140734583924080

@kazum kazum force-pushed the check-shape-type branch 3 times, most recently from c40d53e to 623696a Compare May 8, 2018 05:14
@kazum kazum force-pushed the check-shape-type branch from 623696a to 786b5f1 Compare May 8, 2018 06:04
@tqchen tqchen merged commit 319d9f1 into dmlc:master May 8, 2018
@kazum kazum deleted the check-shape-type branch May 24, 2018 16:50
abergeron pushed a commit to abergeron/nnvm that referenced this pull request May 31, 2018
abergeron pushed a commit to abergeron/nnvm that referenced this pull request May 31, 2018
larroy pushed a commit to larroy/nnvm that referenced this pull request Feb 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants