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

cpu后端的三维tensor在计算卷积时使用的维度有问题 #2689

Closed
shine-xia opened this issue Dec 11, 2023 · 2 comments
Closed

cpu后端的三维tensor在计算卷积时使用的维度有问题 #2689

shine-xia opened this issue Dec 11, 2023 · 2 comments

Comments

@shine-xia
Copy link

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

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

Linux x86_64

Github版本:

Github Version:

commit id 94e1212
tag 2.7.1

问题描述:

手上现在有个模型,需要对三维数据[batch, channel, height]进行一维卷积计算
测试发现,在source/backend/cpu/compute/ConvolutionTiledExecutor.cpp, line 110,会直接获取tensor的width维度而不做检查

dstIm2ColParamter.iw = input->width();

对于上述三维向量,此处获取的width()理论上会是0(但是实际测试也有部分tensor为1,可能是复用的原因)
如果dstIm2ColParamter.iw=0,那么后续gemm计算时很多循环都进不去,卷积计算实际没有生效。

建议

由于iw参与后续较多计算,此处是不是可以加一些逻辑判断。如果实际是三维向量,默认应该返回1比较合理。

@shine-xia shine-xia changed the title cpu后端的三维算子在计算卷积时使用的维度有问题 cpu后端的三维tensor在计算卷积时使用的维度有问题 Dec 11, 2023
@jxt1234
Copy link
Collaborator

jxt1234 commented Jan 6, 2024

目前在模型转换过程中通过插入算子来避免 三维 Tensor 作为卷积输入输出的。这部分要支持的话除去CPU的代码适配,GPU 后端也需要改不少。

@jxt1234
Copy link
Collaborator

jxt1234 commented Jan 8, 2024

另外就是在 SizeCompute 时,会做兼容性处理,把不足4的维度填 1 ,暂时不构成问题

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

No branches or pull requests

2 participants