forked from mindspore-Ecosystem/mindspore
!40946 ascend infer code review
Merge pull request !40946 from zhengyuanhua/br3
This commit is contained in:
commit
c32131f166
|
@ -28,14 +28,17 @@ Status ModelImpl::Build(const void *model_data, size_t data_size, ModelType mode
|
|||
graph_ = std::make_shared<Graph>();
|
||||
auto ret = Serialization::Load(model_data, data_size, model_type, graph_.get());
|
||||
if (ret != kSuccess) {
|
||||
MS_LOG(ERROR) << "Serialization::Load model failed.";
|
||||
return ret;
|
||||
}
|
||||
session_ = InferSession::CreateSession(model_context);
|
||||
if (session_ == nullptr) {
|
||||
MS_LOG(ERROR) << "Create session failed.";
|
||||
return kLiteNullptr;
|
||||
}
|
||||
ret = session_->Init(model_context);
|
||||
if (ret != kSuccess) {
|
||||
MS_LOG(ERROR) << "Init session failed.";
|
||||
return ret;
|
||||
}
|
||||
if (MsContext::GetInstance() == nullptr) {
|
||||
|
|
|
@ -88,6 +88,7 @@ tensor::TensorPtr DefaultInferSession::GetInputByTensorName(const std::string &n
|
|||
std::shared_ptr<InferSession> InferSession::CreateSession(const std::shared_ptr<Context> context) {
|
||||
HandleGPUContext(context);
|
||||
auto config = SelectSessionArg(context);
|
||||
MS_LOG(DEBUG) << "Session type " << static_cast<int64_t>(config.type_);
|
||||
return SessionRegistry::GetInstance().GetSession(config.type_, config);
|
||||
}
|
||||
|
||||
|
|
|
@ -163,6 +163,10 @@ int CustomAscendKernelMod::Resize(const BaseOperatorPtr &base_operator, const st
|
|||
return lite::RET_ERROR;
|
||||
}
|
||||
}
|
||||
if (inputs.size() < 1) {
|
||||
MS_LOG(ERROR) << "inputs size is less than one.";
|
||||
return lite::RET_ERROR;
|
||||
}
|
||||
inputs_.assign(inputs.begin(), inputs.end() - 1);
|
||||
return lite::RET_OK;
|
||||
}
|
||||
|
|
|
@ -219,6 +219,10 @@ Status SingleOpInferSession::ResizeGraphInputs(const std::vector<tensor::TensorP
|
|||
// update input shape
|
||||
inputs_[i]->set_shape(dims[i]);
|
||||
auto abstract = std::make_shared<abstract::AbstractTensor>(TypeIdToType(type_id), dims[i]);
|
||||
if (abstract == nullptr) {
|
||||
MS_LOG(ERROR) << "Abstract is nullptr.";
|
||||
return kLiteError;
|
||||
}
|
||||
graph_input->set_abstract(abstract);
|
||||
}
|
||||
return kSuccess;
|
||||
|
|
|
@ -135,7 +135,7 @@ function Convert() {
|
|||
if [ $? = 0 ]; then
|
||||
converter_result='converter '${model_type}''${quant_type}' '${model_name}' pass';echo ${converter_result} >> $5
|
||||
local model_size
|
||||
if [[ ${export_mindir} =~ "MINDIR" ]]; then
|
||||
if [ "${export_mindir}"x == "MINDIR"x ]; then
|
||||
model_size=`ls ${output_file}.mindir -l|awk -F ' ' '{print $5}'`
|
||||
else
|
||||
model_size=`ls ${output_file}.ms -l|awk -F ' ' '{print $5}'`
|
||||
|
|
Loading…
Reference in New Issue