!885 assign invalid valiu while not find

From: @chen_yemeng
Reviewed-by: @xchu42,@wangxiaotian22,@wqtshg
Signed-off-by: @wqtshg
pull/885/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 8e63c815db

@ -1869,9 +1869,12 @@ Status DavinciModel::InitAippType(uint32_t index, const OpDescPtr &op_desc, cons
}
Status DavinciModel::GetAippType(uint32_t index, InputAippType &aipp_type, size_t &aipp_index) const {
GE_CHK_BOOL_RET_STATUS(index < input_addrs_list_.size(), PARAM_INVALID, "Index %u is invalid", index);
const auto it = aipp_type_list_.find(index);
if (it == aipp_type_list_.end()) {
GELOGW("There is no aipp releated info with index %u.", index);
aipp_type = DATA_WITHOUT_AIPP;
aipp_index = 0xFFFFFFFF;
return SUCCESS;
}

@ -487,7 +487,7 @@ TEST_F(UtestDavinciModel, init_data_aipp_static) {
InputAippType aipp_type;
size_t aipp_index = 0;
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), SUCCESS);
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), PARAM_INVALID);
EXPECT_EQ(model.InitNodes(graph), SUCCESS);
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), SUCCESS);
EXPECT_EQ(aipp_type, DATA_WITH_STATIC_AIPP);
@ -519,7 +519,7 @@ TEST_F(UtestDavinciModel, init_data_aipp_dynamic) {
InputAippType aipp_type;
size_t aipp_index = 0;
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), SUCCESS);
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), PARAM_INVALID);
EXPECT_EQ(model.InitNodes(graph), SUCCESS);
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), SUCCESS);
@ -559,7 +559,7 @@ TEST_F(UtestDavinciModel, init_data_aipp_releated) {
InputAippType aipp_type;
size_t aipp_index = 0;
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), SUCCESS);
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), PARAM_INVALID);
EXPECT_EQ(model.InitNodes(graph), SUCCESS);
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), SUCCESS);
EXPECT_EQ(aipp_type, DATA_WITH_DYNAMIC_AIPP);
@ -590,7 +590,7 @@ TEST_F(UtestDavinciModel, init_data_aipp_dynamic_conf) {
InputAippType aipp_type;
size_t aipp_index = 0;
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), SUCCESS);
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), PARAM_INVALID);
EXPECT_EQ(model.InitNodes(graph), SUCCESS);
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), SUCCESS);
EXPECT_EQ(aipp_type, DYNAMIC_AIPP_NODE);
@ -621,7 +621,7 @@ TEST_F(UtestDavinciModel, init_data_aipp_dynamic_invalid) {
InputAippType aipp_type;
size_t aipp_index = 0;
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), SUCCESS);
EXPECT_EQ(model.GetAippType(0, aipp_type, aipp_index), PARAM_INVALID);
EXPECT_EQ(model.InitNodes(graph), ACL_ERROR_GE_AIPP_MODE_INVALID);
EXPECT_EQ(model.input_addrs_list_.size(), 1);

Loading…
Cancel
Save