Browse Source

Fix case_load_model_encypt_type_unsupported

tags/v1.5.1
zhangxiaokun 3 years ago
parent
commit
cca94f97fb
2 changed files with 5 additions and 4 deletions
  1. +2
    -2
      ge/hybrid/model/node_item.cc
  2. +3
    -2
      tests/ut/ge/graph/load/model_manager_unittest.cc

+ 2
- 2
ge/hybrid/model/node_item.cc View File

@@ -25,7 +25,7 @@ namespace ge {
namespace hybrid {
namespace {
const uint8_t kMaxTransCount = 3;
const uint32_t kTransOpIoSize = 1;
const uint8_t kTransOpIoSize = 1;
const char *const kAttrNameOriginalFusionGraph = "_original_fusion_graph";
const char *const kNodeTypeRetVal = "_RetVal";
const std::set<std::string> kControlOpTypes{
@@ -47,7 +47,7 @@ bool IsEnterFeedNode(NodePtr node) {
// For: Enter -> TransData -> Cast -> node
for (uint8_t i = 0; i < kMaxTransCount; ++i) {
if (kEnterOpTypes.count(NodeUtils::GetNodeType(node)) > 0) {
GELOGD("Node[%u] is Enter feed node.", node->GetName().c_str());
GELOGD("Node[%s] is Enter feed node.", node->GetName().c_str());
return true;
}



+ 3
- 2
tests/ut/ge/graph/load/model_manager_unittest.cc View File

@@ -78,7 +78,7 @@ class UtestModelManagerModelManager : public testing::Test {
const int model_len = 10;
data.model_len = sizeof(ModelFileHeader) + model_len;
data.model_data = new uint8_t[data.model_len];
memset((uint8_t *)data.model_data + sizeof(ModelFileHeader), 10, model_len);
memset((uint8_t *)data.model_data + sizeof(ModelFileHeader), 0, model_len);

ModelFileHeader *header = (ModelFileHeader *)data.model_data;
header->magic = MODEL_FILE_MAGIC_NUM;
@@ -93,7 +93,7 @@ class UtestModelManagerModelManager : public testing::Test {
data.key = ENC_KEY;
data.model_data = new uint8_t[data.model_len];
uint8_t data_ori[model_len];
memset(data_ori, 10, model_len);
memset(data_ori, 0, model_len);
ModelFileHeader *header = (ModelFileHeader *)data.model_data;
header->magic = MODEL_FILE_MAGIC_NUM;
header->version = MODEL_VERSION;
@@ -224,6 +224,7 @@ TEST_F(UtestModelManagerModelManager, case_load_model_encypt_type_unsupported) {
ModelFileHeader *header = (ModelFileHeader *)data.model_data;
header->is_encrypt = 255;
uint32_t model_id = 1;
// Error for: LoadModelPartitionTable: Invalid partition_table->num:0
EXPECT_EQ(mm.LoadModelOffline(model_id, data, nullptr, nullptr), ACL_ERROR_GE_PARAM_INVALID);
delete[](uint8_t *) data.model_data;
}


Loading…
Cancel
Save