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

broadcastTo算子在计算Raster的region时逻辑有问题 #2040

Closed
shine-xia opened this issue Sep 2, 2022 · 4 comments
Closed

broadcastTo算子在计算Raster的region时逻辑有问题 #2040

shine-xia opened this issue Sep 2, 2022 · 4 comments

Comments

@shine-xia
Copy link

shine-xia commented Sep 2, 2022

平台(如果交叉编译请再附上交叉编译目标平台):

Platform(Include target platform as well if cross-compiling):

Linux

Github版本:

Github Version:

2.0.4
Commit:
d601837 [d601837]

source/geometry/ConvertUtils.cpp, line 163/164
在给outputDes->regions计算offset时,忘记先清零了。
导致的问题:
如果先以指定输入shape创建一个session,然后resizeSession,此处的offset会累加上去。
从而导致Raster算子的onExecute()函数中,memcpy()函数发生访问越界。

补充一个测试例子:
yolov5, export to onnx时使用dynamic axis。创建session后先resizeSession到512512,runSession正常工作,再resizeSession到448512,产生segment fault。使用valgrind定位到Raster算子产生访问越界,进一步定位到上述原因。

@jxt1234
Copy link
Collaborator

jxt1234 commented Sep 5, 2022

我们查一下

wangzhaode added a commit to wangzhaode/MNN that referenced this issue Sep 9, 2022
    [Pymnn:Bugfix] Fix usage and small bug in pymnn.
    [Docs:Update] Update docs/cpp markdown
    [Docs:Update] Add docs check.
    [MNN:Update] Update VecHalf.hpp
    [MNN:Bugfix] Fix compile errors caused by "#define MNN_THREAD_LOCK_CPU"
    [Geometry:Bugfix] Fix bug for resize of broadcastto: alibaba#2040
    [Docs:Update] Update inference api usage.
    [Pymnn:Bugfix] Close hiai load to fix resource leak.
    [MNN:Update] Down gradle version for demo compile
@aovoc
Copy link

aovoc commented Sep 9, 2022

这个问题解决了嘛,看问题描述好像应该是在source/geometry/ConvertUtils.cpp, line 162后增加
reg.src.offset = 0; reg.dst.offset = 0;

@jxt1234
Copy link
Collaborator

jxt1234 commented Sep 13, 2022

157 行加了一句 outputDes->regions.clear();
后面在 resize 时会初始化为 0

@jxt1234 jxt1234 closed this as completed Sep 13, 2022
@jxt1234
Copy link
Collaborator

jxt1234 commented Sep 13, 2022

2.1.1 fixed

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

3 participants