Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Paddle TensorRT No.7] add pd_op.numel converter #70612

Closed
wants to merge 5 commits into from

Conversation

lizexu123
Copy link
Contributor

PR Category

Inference

PR Types

New features

Description

card-71500
添加了pd_op.numel converter,并修改了对于tensor未初始化的情况跳过的条件

Comment on lines 32 to 45
const std::unordered_map<::pir::Value, std::vector<int>> &ins =
instr->Inputs();
for (auto &input : ins) {
auto var_name = value_exe_info->GetVarName(input.first);
auto *var = scope->FindVar(var_name);
if (!var || !var->IsType<phi::DenseTensor>()) continue;
auto tensor = var->Get<phi::DenseTensor>();
if (!tensor.initialized()) continue;
for (auto &item : ins) {
if ((ins.count(item.first) && instr->NoNeedBuffer().count(item.first))) {
VLOG(3) << "NoNeedBuffer pir::value not initialized.";
} else {
if (!tensor.initialized()) continue;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你这里怎么写的这么复杂,直接判断tensor未初始化+input.first不在no_need_buffer里后continue,这样不行吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看别的.cc的这个逻辑实现的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants