cjolivier01 commented on a change in pull request #7783: check
num_provided_arg_types and nullptr in simple_bind api for perl
URL: https://github.com/apache/incubator-mxnet/pull/7783#discussion_r137575997
##########
File path: src/c_api/c_api_executor.cc
##########
@@ -259,8 +259,10 @@ int MXExecutorSimpleBind(SymbolHandle symbol_handle,
std::vector<std::string> aux_state_names =
sym->ListInputNames(nnvm::Symbol::kAuxiliaryStates);
// attr_dict for setting up type_dict and arg/aux ctx
+ bool has_stype_provided = provided_arg_stypes != nullptr &&
num_provided_arg_stypes > 0;
+ bool has_dtype_provided = provided_arg_dtypes != nullptr &&
num_provided_arg_dtypes > 0;
std::unordered_map<std::string, std::unordered_map<std::string,
std::string>> attr_dict;
- if (nullptr == provided_arg_dtypes || nullptr != g2c_keys || nullptr ==
provided_arg_stypes) {
+ if (!has_dtype_provided || nullptr != g2c_keys || !has_stype_provided) {
Review comment:
would this read better as:
if (g2c_keys || !has_dtype_provided || !has_stype_provided)
or some order thereof? Up to you.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services