Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Serge Panev <[email protected]>
  • Loading branch information
Kh4L committed Jul 14, 2020
1 parent eb191a1 commit 2bf9c33
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 73 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/mkldnn
Submodule mkldnn updated 123 files
19 changes: 19 additions & 0 deletions include/mxnet/c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -2235,6 +2235,25 @@ MXNET_DLL int MXGenAtomicSymbolFromSymbol(SymbolHandle sym_handle, SymbolHandle
* \param num_options number of key value pairs
* \param keys keys for options
* \param vals values corresponding to keys
* \param num_input_shapes number of input shapes
* \param input_shape_names names of the input shapes
* \param input_shape_data pointer to the contiguous data shapes
* \param input_shape_idx array of per shape starting idx, the shape length for the i-th input shape
* is calculate as input_shape_idx[i+1] - input_shape_idx[i]
* \param num_input_dtypes number of input data types
* \param input_dtype_names array of names of the input data types
* \param input_dtypes array of values of the input data types
* \param num_input_stypesnumber of input storage types
* \param input_stype_names array of names of the input storage types
* \param input_stypes array of values of input storage types
* \param skip_infer if the optimization should skip the attribute inferences
* (to use if the backend does not require shape inference)
* \param new_args_cnt pointer a number to store the number of new args
* \param new_args_handle pointer on array to store the new args handles
* \param new_arg_names_handle pointer on array to store the new args names
* \param new_aux_cnt pointer a number to store the number of new aux
* \param new_aux_handle pointer on array to store the new aux handles
* \param new_aux_names_handle pointer on array to store the new aux names
*/
MXNET_DLL int MXOptimizeForBackend(SymbolHandle sym_handle,
const char* backend_name,
Expand Down
72 changes: 0 additions & 72 deletions src/common/exec_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,78 +369,6 @@ inline void LogInferStorage(const nnvm::Graph& g) {
}
}

// prints a helpful message after shape inference errors in executor.
inline void HandleInferShapeError(const size_t num_forward_inputs,
const nnvm::IndexedGraph& idx,
const mxnet::ShapeVector& inferred_shapes) {
int cnt = 10;
std::ostringstream oss;
for (size_t i = 0; i < num_forward_inputs; ++i) {
const uint32_t nid = idx.input_nodes().at(i);
const uint32_t eid = idx.entry_id(nid, 0);
const mxnet::TShape& inferred_shape = inferred_shapes[eid];
if (!shape_is_known(inferred_shape)) {
const std::string& arg_name = idx[nid].source->attrs.name;
oss << arg_name << ": " << inferred_shape << ", ";
if (--cnt == 0) {
oss << "...";
break;
}
}
}
LOG(FATAL) << "InferShape pass cannot decide shapes for the following arguments "
"(-1 means unknown dimensions). Please consider providing them as inputs:\n"
<< oss.str();
}

// prints a helpful message after type inference errors in executor.
inline void HandleInferTypeError(const size_t num_forward_inputs,
const nnvm::IndexedGraph& idx,
const nnvm::DTypeVector& inferred_dtypes) {
int cnt = 10;
std::ostringstream oss;
for (size_t i = 0; i < num_forward_inputs; ++i) {
const uint32_t nid = idx.input_nodes().at(i);
const uint32_t eid = idx.entry_id(nid, 0);
const int inferred_dtype = inferred_dtypes[eid];
if (inferred_dtype == -1) {
const std::string& arg_name = idx[nid].source->attrs.name;
oss << arg_name << ": " << inferred_dtype << ", ";
if (--cnt == 0) {
oss << "...";
break;
}
}
}
LOG(FATAL) << "InferType pass cannot decide dtypes for the following arguments "
"(-1 means unknown dtype). Please consider providing them as inputs:\n"
<< oss.str();
}

// prints a helpful message after storage type checking errors in executor.
inline void HandleInferStorageTypeError(const size_t num_forward_inputs,
const nnvm::IndexedGraph& idx,
const StorageTypeVector& inferred_stypes) {
int cnt = 10;
std::ostringstream oss;
for (size_t i = 0; i < num_forward_inputs; ++i) {
const uint32_t nid = idx.input_nodes().at(i);
const uint32_t eid = idx.entry_id(nid, 0);
const int inferred_stype = inferred_stypes[eid];
if (inferred_stype == -1) {
const std::string& arg_name = idx[nid].source->attrs.name;
oss << arg_name << ": " << common::stype_string(inferred_stype) << ", ";
if (--cnt == 0) {
oss << "...";
break;
}
}
}
LOG(FATAL) << "InferStorageType pass cannot decide storage type for the following arguments "
"(-1 means unknown stype). Please consider providing them as inputs:\n"
<< oss.str();
}

/*!
* \brief If the requested ndarray's shape size is less than
* the corresponding shared_data_array's shape size and the
Expand Down

0 comments on commit 2bf9c33

Please sign in to comment.