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

BinaryOp的加法操作占用大量内存 #5751

Open
1072946446 opened this issue Oct 21, 2024 · 1 comment
Open

BinaryOp的加法操作占用大量内存 #5751

1072946446 opened this issue Oct 21, 2024 · 1 comment

Comments

@1072946446
Copy link

1072946446 commented Oct 21, 2024

error log | 日志或报错信息 | ログ

在安卓端运行的onnx模型,转化为ncnn模型并运行后,执行到两个张量相加这一行时突然内存占用从1.4g激增到6g以上,并且app内存异常并退出。

context | 编译/运行环境 | バックグラウンド

安卓端基于yolov5的模型改编,ncnn版本为最新的20240820

how to reproduce | 复现步骤 | 再現方法

1.模型第18层的定义为
BinaryOp add_0 2 1 6 17 18
2.其中第六层和第17层的打印输出形状均为
2024-10-21 16:24:20.712 26151-26151 AudioNetWork com.tencent.yolov5ncnn I Layer 6 output shape: [48, 256, 3072, 1]和
2024-10-21 16:24:21.489 26151-26151 AudioNetWork com.tencent.yolov5ncnn I Layer 17 output shape: [48, 256, 3072, 1]
3.打印第0-17层任意一层输出时,安卓的profiler观看内存占用一直为1.4g左右,若改为打印第18层输出即
int ret = ex.extract(“18”, out);
则内存占用直接激增至6g以上并且闪退。
4. 当我修改加法定义为BinaryOp add_0 2 1 6 6 18 0=0 1=0或者
BinaryOp add_0 2 1 17 17 18 0=0 1=0这俩个,即让第六层和第十七层数据分别自我相加时,则不会有此问题,并且自我相加后输出的第十八层数据形状仍然为48,256,3072,1。

more | 其他 | その他

@nihui ,怀疑是广播机制导致的?两个相同shape的四维数组相加是如何处理的?
非常感谢

Tasks

No tasks being tracked yet.
@1072946446
Copy link
Author

model.zip
模型的params文件

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