|
|
|
@@ -162,7 +162,6 @@ DavinciModel::~DavinciModel() { |
|
|
|
GE_CHK_STATUS(ModelRunStop()); |
|
|
|
|
|
|
|
op_list_.clear(); |
|
|
|
data_op_list_.clear(); |
|
|
|
tensor_name_to_fixed_addr_size_.clear(); |
|
|
|
tensor_name_to_peer_output_index_.clear(); |
|
|
|
GE_DELETE_NEW_SINGLE(data_inputer_); |
|
|
|
@@ -963,7 +962,6 @@ Status DavinciModel::InitDataOp(const ComputeGraphPtr &graph, const NodePtr &nod |
|
|
|
} |
|
|
|
|
|
|
|
data_by_index[data_index] = op_desc; |
|
|
|
data_op_list_.push_back(op_desc); |
|
|
|
if (known_node_) { |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
@@ -1011,19 +1009,16 @@ Status DavinciModel::InitDataOp(const ComputeGraphPtr &graph, const NodePtr &nod |
|
|
|
/// |
|
|
|
Status DavinciModel::OptInputOutputInfo(const map<uint32_t, OpDescPtr> &data_by_index, |
|
|
|
const vector<OpDescPtr> &output_op_list) { |
|
|
|
GELOGD("Data node size: %zu, NetOutput node size: %zu", data_op_list_.size(), output_op_list.size()); |
|
|
|
if (data_by_index.size() != data_op_list_.size()) { |
|
|
|
GELOGE(INTERNAL_ERROR, "Data map size: %zu, Data list size: %zu.", data_by_index.size(), data_op_list_.size()); |
|
|
|
return INTERNAL_ERROR; |
|
|
|
} |
|
|
|
|
|
|
|
data_op_list_.clear(); |
|
|
|
GELOGD("Data node size: %zu, NetOutput node size: %zu", data_by_index.size(), output_op_list.size()); |
|
|
|
for (auto &item : data_by_index) { |
|
|
|
data_op_list_.emplace_back(item.second); |
|
|
|
auto output_addrs = ModelUtils::GetOutputDataAddrs(runtime_param_, item.second); |
|
|
|
GELOGD("Data node: %s, output addr size: %zu", item.second->GetName().c_str(), output_addrs.size()); |
|
|
|
input_addrs_list_.emplace_back(output_addrs); |
|
|
|
|
|
|
|
GE_CHK_STATUS_RET(InitAIPPInfo(item.first, item.second), "Init AIPP Info failed"); |
|
|
|
GE_CHK_STATUS_RET(InitAippType(item.first, item.second, data_by_index), "Init AIPP Type failed"); |
|
|
|
GE_CHK_STATUS_RET(InitOrigInputInfo(item.first, item.second), "Init Orig input failed"); |
|
|
|
GE_CHK_STATUS_RET(InitAippInputOutputDims(item.first, item.second), "Init AIPP dims failed"); |
|
|
|
if (item.second->GetType() == AIPP_DATA_TYPE) { |
|
|
|
GELOGI("This is dynamic aipp model, Node: %s", item.second->GetName().c_str()); |
|
|
|
is_dynamic_aipp_ = true; |
|
|
|
@@ -1051,7 +1046,8 @@ Status DavinciModel::OptInputOutputInfo(const map<uint32_t, OpDescPtr> &data_by_ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return InitOutputDescInfo(output_op_list, output_descs_, output_formats_); |
|
|
|
GE_CHK_STATUS_RET(InitInputDescInfo(data_by_index), "Init input desc info failed"); |
|
|
|
return InitOutputDescInfo(output_op_list); |
|
|
|
} |
|
|
|
|
|
|
|
bool DavinciModel::IsGetNextSinkDynamic(const OpDescPtr &op_desc) { |
|
|
|
@@ -1750,73 +1746,94 @@ void DavinciModel::GetUserDesignateShapeOrder(std::vector<std::string> &user_inp |
|
|
|
/// @ingroup ge |
|
|
|
/// @brief Get AIPP input info |
|
|
|
/// @param [in] index |
|
|
|
/// @param [out] aipp_info |
|
|
|
/// @param [int] OpDescPtr |
|
|
|
/// @return execute result |
|
|
|
/// |
|
|
|
Status DavinciModel::GetAIPPInfo(uint32_t index, AippConfigInfo &aipp_info) { |
|
|
|
GE_CHK_BOOL_RET_STATUS(index < data_op_list_.size(), PARAM_INVALID, "Index %u is invalid.", index); |
|
|
|
OpDescPtr data_op = data_op_list_[index]; |
|
|
|
if (!data_op->HasAttr(ATTR_NAME_AIPP)) { |
|
|
|
Status DavinciModel::InitAIPPInfo(uint32_t index, const OpDescPtr &op_desc) { |
|
|
|
if (!op_desc->HasAttr(ATTR_NAME_AIPP)) { |
|
|
|
GELOGW("GetAIPPInfo: there is not AIPP related with index %u.", index); |
|
|
|
return ACL_ERROR_GE_AIPP_NOT_EXIST; |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
std::unique_ptr<domi::AippOpParams> aipp_params(new (std::nothrow) domi::AippOpParams()); |
|
|
|
GE_CHECK_NOTNULL(aipp_params); |
|
|
|
|
|
|
|
ge::GeAttrValue::NAMED_ATTRS aipp_attr; |
|
|
|
GE_CHK_BOOL_RET_STATUS(AttrUtils::GetNamedAttrs(data_op, ATTR_NAME_AIPP, aipp_attr), GE_AIPP_NOT_EXIST, |
|
|
|
domi::AippOpParams aipp_params; |
|
|
|
GeAttrValue::NAMED_ATTRS aipp_attr; |
|
|
|
GE_CHK_BOOL_RET_STATUS(AttrUtils::GetNamedAttrs(op_desc, ATTR_NAME_AIPP, aipp_attr), GE_AIPP_NOT_EXIST, |
|
|
|
"Data node do not contain param aipp!"); |
|
|
|
GE_CHK_STATUS_RET(OpUtils::ConvertAippParams(aipp_attr, aipp_params.get()), "get aipp params failed"); |
|
|
|
GE_CHK_STATUS_RET(OpUtils::ConvertAippParams(aipp_attr, &aipp_params), "get aipp params failed"); |
|
|
|
GELOGI("GetAIPPInfo: node data: %s, type: %s, current index: %u, current node related input rank: %u", |
|
|
|
data_op->GetName().c_str(), data_op->GetType().c_str(), index, aipp_params->related_input_rank()); |
|
|
|
op_desc->GetName().c_str(), op_desc->GetType().c_str(), index, aipp_params.related_input_rank()); |
|
|
|
|
|
|
|
GE_CHK_STATUS_RET(AippUtils::ConvertAippParams2AippInfo(aipp_params.get(), aipp_info), |
|
|
|
AippConfigInfo aipp_info; |
|
|
|
GE_CHK_STATUS_RET(AippUtils::ConvertAippParams2AippInfo(&aipp_params, aipp_info), |
|
|
|
"convert aipp params to aipp config info failed"); |
|
|
|
|
|
|
|
aipp_info_list_[index] = aipp_info; |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
Status DavinciModel::GetAippType(uint32_t index, InputAippType &type, size_t &aipp_index) { |
|
|
|
GE_CHK_BOOL_RET_STATUS(index < data_op_list_.size(), PARAM_INVALID, "Index %u is invalid.", index); |
|
|
|
// Set default value |
|
|
|
type = DATA_WITHOUT_AIPP; |
|
|
|
aipp_index = 0xFFFFFFFF; // default invalid value |
|
|
|
OpDescPtr data_op = data_op_list_[index]; |
|
|
|
GE_CHECK_NOTNULL(data_op); |
|
|
|
if (!data_op->HasAttr(ATTR_DATA_RELATED_AIPP_MODE)) { |
|
|
|
Status DavinciModel::GetAIPPInfo(uint32_t index, AippConfigInfo &aipp_info) { |
|
|
|
const auto it = aipp_info_list_.find(index); |
|
|
|
if (it == aipp_info_list_.end()) { |
|
|
|
GELOGW("GetAIPPInfo: there is not AIPP related with index %u.", index); |
|
|
|
return ACL_ERROR_GE_AIPP_NOT_EXIST; |
|
|
|
} |
|
|
|
|
|
|
|
aipp_info = it->second; |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
Status DavinciModel::InitAippType(uint32_t index, const OpDescPtr &op_desc, const map<uint32_t, OpDescPtr> &data_list) { |
|
|
|
if (!op_desc->HasAttr(ATTR_DATA_RELATED_AIPP_MODE)) { |
|
|
|
GELOGW("There is no aipp releated info with index %u.", index); |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
std::string data_mode; |
|
|
|
(void)AttrUtils::GetStr(data_op, ATTR_DATA_RELATED_AIPP_MODE, data_mode); |
|
|
|
|
|
|
|
// Set default value |
|
|
|
InputAippType aipp_type = DATA_WITHOUT_AIPP; |
|
|
|
string data_mode; |
|
|
|
(void)AttrUtils::GetStr(op_desc, ATTR_DATA_RELATED_AIPP_MODE, data_mode); |
|
|
|
if (data_mode == "static_aipp") { |
|
|
|
type = DATA_WITH_STATIC_AIPP; |
|
|
|
aipp_type = DATA_WITH_STATIC_AIPP; |
|
|
|
} else if (data_mode == "dynamic_aipp") { |
|
|
|
type = DATA_WITH_DYNAMIC_AIPP; |
|
|
|
aipp_type = DATA_WITH_DYNAMIC_AIPP; |
|
|
|
} else if (data_mode == "dynamic_aipp_conf") { |
|
|
|
type = DYNAMIC_AIPP_NODE; |
|
|
|
aipp_type = DYNAMIC_AIPP_NODE; |
|
|
|
} else { |
|
|
|
GELOGE(ACL_ERROR_GE_AIPP_MODE_INVALID, |
|
|
|
"The info of aipp releated info %s is invalid with index %u.", data_mode.c_str(), index); |
|
|
|
return ACL_ERROR_GE_AIPP_MODE_INVALID; |
|
|
|
} |
|
|
|
|
|
|
|
if (type == DATA_WITH_DYNAMIC_AIPP) { |
|
|
|
size_t aipp_index = 0xFFFFFFFF; // default invalid value |
|
|
|
if (aipp_type == DATA_WITH_DYNAMIC_AIPP) { |
|
|
|
string releated_name; |
|
|
|
(void)AttrUtils::GetStr(data_op, ATTR_DATA_AIPP_DATA_NAME_MAP, releated_name); |
|
|
|
for (size_t i = 0; i < data_op_list_.size(); ++i) { |
|
|
|
GE_CHECK_NOTNULL(data_op_list_[i]); |
|
|
|
if (data_op_list_[i]->GetName() == releated_name) { |
|
|
|
GELOGI("Find aipp_data [%s] index %zu from index %u", releated_name.c_str(), i, index); |
|
|
|
aipp_index = i; |
|
|
|
(void)AttrUtils::GetStr(op_desc, ATTR_DATA_AIPP_DATA_NAME_MAP, releated_name); |
|
|
|
for (const auto item : data_list) { |
|
|
|
if (item.second->GetName() == releated_name) { |
|
|
|
GELOGI("Find aipp_data [%s] index %zu from index %u", releated_name.c_str(), item.first, index); |
|
|
|
aipp_index = item.first; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (aipp_index == 0xFFFFFFFF) { |
|
|
|
GELOGE(ACL_ERROR_GE_AIPP_NOT_EXIST, "Can not find aipp data node from index %u", index); |
|
|
|
return ACL_ERROR_GE_AIPP_NOT_EXIST; |
|
|
|
GELOGW("Can not find aipp data node from index %u", index); |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
aipp_type_list_[index] = { aipp_type, aipp_index }; |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
Status DavinciModel::GetAippType(uint32_t index, InputAippType &aipp_type, size_t &aipp_index) { |
|
|
|
const auto it = aipp_type_list_.find(index); |
|
|
|
if (it == aipp_type_list_.end()) { |
|
|
|
GELOGE(ACL_ERROR_GE_AIPP_NOT_EXIST, "Can not find aipp data node from index %u", index); |
|
|
|
return ACL_ERROR_GE_AIPP_NOT_EXIST; |
|
|
|
} |
|
|
|
|
|
|
|
aipp_type = it->second.first; |
|
|
|
aipp_index = it->second.second; |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -1925,24 +1942,30 @@ void DavinciModel::CreateInputDimsInfo(const OpDescPtr &op_desc, Format format, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Status DavinciModel::GetInputDescInfo(vector<InputOutputDescInfo> &input_desc, std::vector<uint32_t> &formats) { |
|
|
|
for (size_t index = 0; index < data_op_list_.size(); ++index) { |
|
|
|
InputOutputDescInfo input; |
|
|
|
GE_CHECK_NOTNULL(data_op_list_[index]); |
|
|
|
GE_CHECK_NOTNULL(data_op_list_[index]->GetInputDescPtr(0)); |
|
|
|
Status DavinciModel::InitInputDescInfo(const map<uint32_t, OpDescPtr> &data_by_index) { |
|
|
|
for (const auto &item : data_by_index) { |
|
|
|
const auto op_desc = item.second; |
|
|
|
GE_CHECK_NOTNULL(op_desc->GetInputDescPtr(0)); |
|
|
|
|
|
|
|
Format format = data_op_list_[index]->GetInputDescPtr(0)->GetFormat(); |
|
|
|
CreateInputDimsInfo(data_op_list_[index], format, input); |
|
|
|
InputOutputDescInfo input; |
|
|
|
Format format = op_desc->GetInputDescPtr(0)->GetFormat(); |
|
|
|
CreateInputDimsInfo(op_desc, format, input); |
|
|
|
|
|
|
|
input.data_type = data_op_list_[index]->GetInputDescPtr(0)->GetDataType(); |
|
|
|
input.name = data_op_list_[index]->GetName(); |
|
|
|
input.data_type = op_desc->GetInputDescPtr(0)->GetDataType(); |
|
|
|
input.name = op_desc->GetName(); |
|
|
|
int64_t input_size = 0; |
|
|
|
GE_CHK_STATUS_RET(TensorUtils::GetSize(*data_op_list_[index]->GetInputDescPtr(0), input_size), |
|
|
|
"get input size failed."); |
|
|
|
GE_CHK_STATUS_RET(TensorUtils::GetSize(*op_desc->GetInputDescPtr(0), input_size), "get input size failed."); |
|
|
|
input.size = input_size; |
|
|
|
formats.push_back(format); |
|
|
|
input_desc.push_back(input); |
|
|
|
input_formats_.push_back(format); |
|
|
|
input_descs_.push_back(input); |
|
|
|
} |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
Status DavinciModel::GetInputDescInfo(vector<InputOutputDescInfo> &input_descs, vector<uint32_t> &input_formats) { |
|
|
|
input_descs.insert(input_descs.end(), input_descs_.begin(), input_descs_.end()); |
|
|
|
input_formats.insert(input_formats.end(), input_formats_.begin(), input_formats_.end()); |
|
|
|
|
|
|
|
// cause GetInputDescInfo called not only once, set is_new_model_desc_ to false after calc the model input dims |
|
|
|
is_new_model_desc_ = false; |
|
|
|
return SUCCESS; |
|
|
|
@@ -2001,8 +2024,7 @@ void DavinciModel::CreateOutput(uint32_t index, const OpDescPtr &op_desc, InputO |
|
|
|
output.data_type = op_desc->GetInputDescPtr(index)->GetDataType(); |
|
|
|
} |
|
|
|
|
|
|
|
Status DavinciModel::InitOutputDescInfo(const vector<OpDescPtr> &output_op_list, |
|
|
|
vector<InputOutputDescInfo> &output_descs, vector<uint32_t> &output_formats) { |
|
|
|
Status DavinciModel::InitOutputDescInfo(const vector<OpDescPtr> &output_op_list) { |
|
|
|
GELOGD("Output node size: %zu", output_op_list.size()); |
|
|
|
for (const auto &op_desc : output_op_list) { |
|
|
|
uint32_t out_size = static_cast<uint32_t>(op_desc->GetInputsSize()); |
|
|
|
@@ -2027,8 +2049,8 @@ Status DavinciModel::InitOutputDescInfo(const vector<OpDescPtr> &output_op_list, |
|
|
|
std::to_string(src_index[index]); |
|
|
|
} |
|
|
|
output.name = output_name; |
|
|
|
output_descs.push_back(output); |
|
|
|
output_formats.push_back(format_result); |
|
|
|
output_descs_.push_back(output); |
|
|
|
output_formats_.push_back(format_result); |
|
|
|
} |
|
|
|
} |
|
|
|
return SUCCESS; |
|
|
|
@@ -2040,15 +2062,6 @@ Status DavinciModel::GetOutputDescInfo(vector<InputOutputDescInfo> &output_descs |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
ge::Format DavinciModel::GetFormat() { |
|
|
|
if ((data_op_list_.empty()) || data_op_list_[0] == nullptr || data_op_list_[0]->GetInputDescPtr(0) == nullptr) { |
|
|
|
GELOGW("OP List Pointer is null or input_desc size is not 1!"); |
|
|
|
return FORMAT_NCHW; |
|
|
|
} |
|
|
|
|
|
|
|
return data_op_list_[0]->GetInputDescPtr(0)->GetFormat(); |
|
|
|
} |
|
|
|
|
|
|
|
Status DavinciModel::CopyInputData(const InputData &input_data, bool device_data) { |
|
|
|
rtMemcpyKind_t kind = device_data ? RT_MEMCPY_DEVICE_TO_DEVICE : RT_MEMCPY_HOST_TO_DEVICE; |
|
|
|
const std::vector<DataBuffer> &blobs = input_data.blobs; |
|
|
|
@@ -3952,25 +3965,44 @@ void DavinciModel::SetTotalFixedAddrsSize(string tensor_name, int64_t fix_addr_s |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Status DavinciModel::GetOrigInputInfo(uint32_t index, OriginInputInfo &orig_input_info) { |
|
|
|
GE_CHK_BOOL_RET_STATUS(index < data_op_list_.size(), PARAM_INVALID, "Index %u is invalid.", index); |
|
|
|
OpDescPtr data_op = data_op_list_[index]; |
|
|
|
if (!data_op->HasAttr(ATTR_NAME_AIPP_INPUTS) || !data_op->HasAttr(ATTR_NAME_AIPP_OUTPUTS)) { |
|
|
|
GELOGE(ACL_ERROR_GE_AIPP_NOT_EXIST, "GetOrigInputInfo: there is not AIPP related with index %u.", index); |
|
|
|
return ACL_ERROR_GE_AIPP_NOT_EXIST; |
|
|
|
Status DavinciModel::InitOrigInputInfo(uint32_t index, const OpDescPtr &op_desc) { |
|
|
|
if (!op_desc->HasAttr(ATTR_NAME_AIPP_INPUTS) || !op_desc->HasAttr(ATTR_NAME_AIPP_OUTPUTS)) { |
|
|
|
GELOGI("there is not AIPP related with index %u, node: %s.", index, op_desc->GetName().c_str()); |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
vector<std::string> inputs; |
|
|
|
if (AttrUtils::GetListStr(data_op, ATTR_NAME_AIPP_INPUTS, inputs) && !inputs.empty()) { |
|
|
|
vector<string> inputs; |
|
|
|
if (AttrUtils::GetListStr(op_desc, ATTR_NAME_AIPP_INPUTS, inputs) && !inputs.empty()) { |
|
|
|
std::string input = inputs[kAippOriginInputIndex]; |
|
|
|
GELOGI("GetOrigInputInfo: origin input str: %s", input.c_str()); |
|
|
|
std::vector<std::string> infos = ge::StringUtils::Split(input, ':'); |
|
|
|
if (infos.size() != kAippInfoNum) { |
|
|
|
GELOGW("origin input str is invalid."); |
|
|
|
} |
|
|
|
orig_input_info.format = TypeUtils::SerialStringToFormat(infos[kAippInfoFormat]); |
|
|
|
orig_input_info.data_type = TypeUtils::SerialStringToDataType(infos[kAippInfoDataType]); |
|
|
|
orig_input_info.dim_num = std::strtol(infos[kAippInfoDimNum].c_str(), nullptr, kDecimal); |
|
|
|
|
|
|
|
OriginInputInfo input_info; |
|
|
|
input_info.format = TypeUtils::SerialStringToFormat(infos[kAippInfoFormat]); |
|
|
|
input_info.data_type = TypeUtils::SerialStringToDataType(infos[kAippInfoDataType]); |
|
|
|
input_info.dim_num = std::strtol(infos[kAippInfoDimNum].c_str(), nullptr, kDecimal); |
|
|
|
orig_input_info_[index] = input_info; |
|
|
|
} else { |
|
|
|
OriginInputInfo input_info = { FORMAT_RESERVED, DT_UNDEFINED, 0 }; |
|
|
|
orig_input_info_[index] = input_info; |
|
|
|
} |
|
|
|
|
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
Status DavinciModel::GetOrigInputInfo(uint32_t index, OriginInputInfo &orig_input_info) { |
|
|
|
const auto it = orig_input_info_.find(index); |
|
|
|
if (it == orig_input_info_.end()) { |
|
|
|
GELOGE(ACL_ERROR_GE_AIPP_NOT_EXIST, "GetOrigInputInfo: there is not AIPP related with index %u.", index); |
|
|
|
return ACL_ERROR_GE_AIPP_NOT_EXIST; |
|
|
|
} |
|
|
|
|
|
|
|
const OriginInputInfo &input_info = it->second; |
|
|
|
if (input_info.format != FORMAT_RESERVED || input_info.data_type != DT_UNDEFINED) { |
|
|
|
orig_input_info = input_info; |
|
|
|
} |
|
|
|
|
|
|
|
return SUCCESS; |
|
|
|
@@ -3995,39 +4027,36 @@ void DavinciModel::ParseAIPPInfo(std::string in_out_info, InputOutputDims &dims_ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Status DavinciModel::GetAllAippInputOutputDims(uint32_t index, std::vector<InputOutputDims> &input_dims, |
|
|
|
std::vector<InputOutputDims> &output_dims) { |
|
|
|
GE_CHK_BOOL_RET_STATUS(index < data_op_list_.size(), PARAM_INVALID, "Index %u is invalid.", index); |
|
|
|
OpDescPtr data_op = data_op_list_[index]; |
|
|
|
if (!data_op->HasAttr(ATTR_NAME_AIPP_INPUTS) || !data_op->HasAttr(ATTR_NAME_AIPP_OUTPUTS)) { |
|
|
|
GELOGE(ACL_ERROR_GE_AIPP_NOT_EXIST, "GetAllAippInputOutputDims: there is not AIPP related with index %u.", index); |
|
|
|
return ACL_ERROR_GE_AIPP_NOT_EXIST; |
|
|
|
Status DavinciModel::InitAippInputOutputDims(uint32_t index, const OpDescPtr &op_desc) { |
|
|
|
if (!op_desc->HasAttr(ATTR_NAME_AIPP_INPUTS) || !op_desc->HasAttr(ATTR_NAME_AIPP_OUTPUTS)) { |
|
|
|
GELOGI("there is not AIPP related with index %u.", index); |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
vector<std::string> inputs; |
|
|
|
if (AttrUtils::GetListStr(data_op, ATTR_NAME_AIPP_INPUTS, inputs) && !inputs.empty()) { |
|
|
|
GELOGI("GetAllAippInputOutputDims: Data: %s has %zu related aippInfo.", data_op->GetName().c_str(), inputs.size()); |
|
|
|
vector<string> inputs; |
|
|
|
vector<InputOutputDims> input_dims; |
|
|
|
if (AttrUtils::GetListStr(op_desc, ATTR_NAME_AIPP_INPUTS, inputs) && !inputs.empty()) { |
|
|
|
GELOGI("Data: %s has %zu related aippInfo.", op_desc->GetName().c_str(), inputs.size()); |
|
|
|
for (auto it : inputs) { |
|
|
|
InputOutputDims input_info; |
|
|
|
ParseAIPPInfo(it, input_info); |
|
|
|
input_dims.emplace_back(input_info); |
|
|
|
GELOGD("GetAllAippInputOutputDims Aipp origin input dims info: %s", it.c_str()); |
|
|
|
|
|
|
|
ConstGeTensorDescPtr data_input_desc = data_op->GetInputDescPtr(kDataIndex); |
|
|
|
ConstGeTensorDescPtr data_input_desc = op_desc->GetInputDescPtr(kDataIndex); |
|
|
|
int64_t data_input_size; |
|
|
|
(void)TensorUtils::GetSize(*(data_op->GetInputDescPtr(kDataIndex)), data_input_size); |
|
|
|
GELOGD( |
|
|
|
"GetAllAippInputOutputDims related Data[%d]: tensor_name is %s, dim_num is %zu, tensor_size: %zu, format: " |
|
|
|
"%s, data_type: %s, shape: %s .", |
|
|
|
index, data_op->GetName().c_str(), data_input_desc->GetShape().GetDimNum(), data_input_size, |
|
|
|
TypeUtils::FormatToSerialString(data_input_desc->GetFormat()).c_str(), |
|
|
|
TypeUtils::DataTypeToSerialString(data_input_desc->GetDataType()).c_str(), |
|
|
|
formats::JoinToString(data_input_desc->GetShape().GetDims()).c_str()); |
|
|
|
(void)TensorUtils::GetSize(*(op_desc->GetInputDescPtr(kDataIndex)), data_input_size); |
|
|
|
GELOGD("related Data[%d]: tensor_name: %s, dim_num: %zu, tensor_size: %zu, format: %s, data_type: %s, shape: %s", |
|
|
|
index, op_desc->GetName().c_str(), data_input_desc->GetShape().GetDimNum(), data_input_size, |
|
|
|
TypeUtils::FormatToSerialString(data_input_desc->GetFormat()).c_str(), |
|
|
|
TypeUtils::DataTypeToSerialString(data_input_desc->GetDataType()).c_str(), |
|
|
|
formats::JoinToString(data_input_desc->GetShape().GetDims()).c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
vector<std::string> outputs; |
|
|
|
if (AttrUtils::GetListStr(data_op, ATTR_NAME_AIPP_OUTPUTS, outputs) && !outputs.empty()) { |
|
|
|
vector<string> outputs; |
|
|
|
vector<InputOutputDims> output_dims; |
|
|
|
if (AttrUtils::GetListStr(op_desc, ATTR_NAME_AIPP_OUTPUTS, outputs) && !outputs.empty()) { |
|
|
|
for (auto it : outputs) { |
|
|
|
InputOutputDims output_info; |
|
|
|
ParseAIPPInfo(it, output_info); |
|
|
|
@@ -4036,6 +4065,20 @@ Status DavinciModel::GetAllAippInputOutputDims(uint32_t index, std::vector<Input |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
aipp_dims_info_[index] = { input_dims, input_dims }; |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
Status DavinciModel::GetAllAippInputOutputDims(uint32_t index, vector<InputOutputDims> &input_dims, |
|
|
|
vector<InputOutputDims> &output_dims) { |
|
|
|
const auto it = aipp_dims_info_.find(index); |
|
|
|
if (it == aipp_dims_info_.end()) { |
|
|
|
GELOGE(ACL_ERROR_GE_AIPP_NOT_EXIST, "GetAllAippInputOutputDims: there is not AIPP related with index %u.", index); |
|
|
|
return ACL_ERROR_GE_AIPP_NOT_EXIST; |
|
|
|
} |
|
|
|
|
|
|
|
input_dims = it->second.first; |
|
|
|
output_dims = it->second.second; |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
|