electriclilies edited a comment on pull request #9861:
URL: https://github.com/apache/tvm/pull/9861#issuecomment-1007648766
Another possible solution is adding a HasValue method and a list of
defaults.
```
Map<string, string> defualt_values = ["virtual_device_", "0"]
bool HasValue(const char* key) {
return jnode_->attrs.find(key);
}
```
Then, we can replace calls to GetValue with:
```
if (!HasValue(key) && key in default_values) {
return default_values[key];
} else {
LOG(FATAL) << "JSONReader: cannot find field";
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]