fix bug of control flow stuck

This commit is contained in:
mengyuanli 2022-02-25 16:34:29 +08:00
parent f52ca3053c
commit 320f2f605e
3 changed files with 15 additions and 4 deletions

View File

@ -143,14 +143,25 @@ int LiteExitOpActor::PreInit(std::vector<std::shared_ptr<LiteOpActor>> *actors,
return RET_OK;
}
bool LiteExitOpActor::IsSubSet(const std::vector<lite::Tensor *> &all_set, const std::vector<lite::Tensor *> &sub_set) {
if (sub_set.size() > all_set.size()) {
return false;
}
for (auto &sub_item : sub_set) {
if (std::find(all_set.begin(), all_set.end(), sub_item) == all_set.end()) {
return false;
}
}
return true;
}
int LiteExitOpActor::RecordCallNodeOutputActor(std::vector<std::shared_ptr<LiteOpActor>> *actors) {
actors_ = actors;
for (auto actor : *actors_) {
auto actor_in_tensors = actor->GetKernel()->in_tensors();
for (auto &info : all_mapping_info_) {
auto &call = info.call_node;
if (std::includes(actor_in_tensors.begin(), actor_in_tensors.end(), call->out_tensors().begin(),
call->out_tensors().end())) {
if (IsSubSet(actor_in_tensors, call->out_tensors())) {
info.call_output_aid = actor->GetAID();
}
}

View File

@ -50,6 +50,7 @@ class LiteExitOpActor : public LiteOpActor {
int RecordCallNodeOutputActor(std::vector<std::shared_ptr<LiteOpActor>> *actors);
void RecordPartialNodeInputActor();
void SetEntranceInputAID(OpData<Tensor> *inputs);
bool IsSubSet(const std::vector<lite::Tensor *> &all_set, const std::vector<lite::Tensor *> &sub_set);
std::vector<std::shared_ptr<LiteOpActor>> *actors_{};
std::vector<MappingInfo> all_mapping_info_{};

View File

@ -18,8 +18,7 @@ ControlOneIfOneScaleOneScale.mindir;3
add_if_while.mindir;3
add_if_after_while_after_for.mindir;3
add_if_after_if.mindir;3
#stuck in sumsang phone
#add_for_while.mindir;3
add_for_while.mindir;3
add_for_if.mindir;3
switchlayer.mindir;3
HDC_multimedia_3M_vit32_60ep_clip_vit_base_image.mindir 3