Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BYOC][JSON] Support input nodes with multiple entries #6368

Merged
merged 2 commits into from
Sep 1, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/runtime/contrib/json/json_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class JSONRuntimeBase : public ModuleNode {
<< "Found mismatch in the number of provided data entryies and required.";

for (size_t i = 0; i < static_cast<size_t>(args.size()); i++) {
auto eid = i < input_var_idx_.size() ? EntryID(input_var_idx_[i], 0)
auto eid = i < input_var_idx_.size() ? input_var_idx_[i]
: EntryID(outputs_[i - input_var_idx_.size()]);
CHECK(args[i].type_code() == kTVMNDArrayHandle || args[i].type_code() == kTVMDLTensorHandle)
<< "Expect NDArray or DLTensor as inputs";
Expand Down Expand Up @@ -183,7 +183,10 @@ class JSONRuntimeBase : public ModuleNode {
uint32_t nid = input_nodes_[i];
std::string name = nodes_[nid].name_;
if (nodes_[nid].op_type_ == "input") {
input_var_idx_.push_back(nid);
CHECK_EQ(nodes_[nid].GetOpShape().size(), nodes_[nid].GetOpDataType().size());
for (size_t j = 0; j < nodes_[nid].GetOpShape().size(); ++j) {
input_var_idx_.push_back(EntryID(nid, j));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By doing so, input_var_idx_ is not keeping index but entry ID. I'd suggest renaming it to be clearer.

}
} else {
CHECK_EQ(nodes_[nid].op_type_, "const");
auto pos = std::find(std::begin(const_names_), std::end(const_names_), name);
Expand Down