[MXNET-38]add reshape predicator function to c_predict_api#9984
Conversation
| PredictorHandle* out) { | ||
| MXAPIPredictor* p = static_cast<MXAPIPredictor*>(handle); | ||
| MXAPIPredictor* ret = new MXAPIPredictor(); | ||
|
|
There was a problem hiding this comment.
please wrap with unique_ptr and then if all is successful, assign with the result of .release()
| API_END_HANDLE_ERROR(delete ret); | ||
| } | ||
|
|
||
| int MXPredReshape(mx_uint num_input_nodes, |
There was a problem hiding this comment.
when does this get called? during training or during setup?
There was a problem hiding this comment.
during testing, when you need to change the input shape of an already created predicator.
| ret->key2arg = p->key2arg; | ||
|
|
||
| try { | ||
| std::vector<TShape> in_shapes; |
| // bind | ||
| { | ||
| std::map<std::string, Context> ctx_map; | ||
| std::vector<NDArray> grad_store(ret->arg_arrays.size()); |
There was a problem hiding this comment.
this and other places, defining to a size causes all of the constructors to be called. if the item is simply overwritten shortly after (ie the init item is just a placeholder), then it is more efficient (sometimes by a lot) to create an empty vector, call reserve() for the number of desired items, and then use emplace_back() (or push_back() if emplace can’t be called)
|
Hi, the community has passed to vote about associating the code changes with JIRA (https://lists.apache.org/thread.html/ab22cf0e35f1bce2c3bf3bec2bc5b85a9583a3fe7fd56ba1bbade55f@%3Cdev.mxnet.apache.org%3E) We have updated the guidelines for contributors in https://cwiki.apache.org/confluence/display/MXNET/Development+Process, please ensure that you have created a JIRA at https://issues.apache.org/jira/projects/MXNET/issues/ to describe your work in this pull request and include the JIRA title in your PR as [MXNET-xxxx] your title where MXNET-xxxx is the JIRA id Thanks! |
|
@cjolivier01 I have updated the pr |
|
@cjolivier01 can this pr be merge? |
* add reshape predicator function to c_predict_api * fix * fix * fix
* add reshape predicator function to c_predict_api * fix * fix * fix
* add reshape predicator function to c_predict_api * fix * fix * fix
Description
add a function to c_predict_api which can change the input shape of an already created predicator .
related issue: #5360
Checklist
Essentials
make lint)Changes
Comments