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

手动创建的net,推理慢了很多 #5438

Open
w1005444804 opened this issue Apr 22, 2024 · 0 comments
Open

手动创建的net,推理慢了很多 #5438

w1005444804 opened this issue Apr 22, 2024 · 0 comments

Comments

@w1005444804
Copy link

std::vector<std::pair<ncnn::Layer*, ncnn::Option>> net;//手动创建的net。net是串联的
std::vectorncnn::Mat blob_mats;//用于net的输入与输出
ncnn::Option opt;

bool infer(const ncnn::Mat& input, ncnn::Mat& output) {
blob_mats[0] = input;
for (size_t i = 0; i < net.size(); i++) {
net[i].first->forward(blob_mats[i], blob_mats[i+1], net[i].second);
}
output = blob_mats[net.size()];
return true;
}
同样的模型,为什么这样操作会比使用onnx转ncnn的模型慢了三倍?
@maxint @cook

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

No branches or pull requests

1 participant