We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
你好叮咚工作室大佬们,我最近在采用KuiperInfer部署一个声音分类框架。在确定计算图的执行正确的情况下,我发现在输出空间初始化方面从某个节点开始出现了些问题。如图所示: 输出空间初始化部分这几天看代码大概明白了一些,const std::vectorpnnx::Operator*& pnnx_operators, const std::vector<std::shared_ptr>& operators
初始化时候为了提升内存效率,避免不必要的数据拷贝,可以对之前执行的节点的输出空间进行共享,这样既不会印象后继节点的输出还能对之前具有相同size的空间进行共用,具体体现在这里:
不知道我的理解对吗? 另外,我发现对于上图transpose节点后的计算图经过拓扑排序后,pnnx_operators,operators二者的顺序差距会非常大。这样多个并行的结构经过调试我发现初始化输出空间时候会因为顺序的原因导致初始化输出空间维度不对。 对此我加入了以下代码 这样操作保证在获取之前产生共享空间失败后使用初始化空间的shape与当前操作的算子输出空间shape一致。不知道我以上分析的是否正确,还望能一起讨论。
The text was updated successfully, but these errors were encountered:
你以下的理解是对的,但是不知道针对你的修改部分,能不能提交一个pr,让我仔细看一下。 “”““ 另外,我发现对于上图transpose节点后的计算图经过拓扑排序后,pnnx_operators,operators二者的顺序差距会非常大。这样多个并行的结构经过调试我发现初始化输出空间时候会因为顺序的原因导致初始化输出空间维度不对。 对此我加入了以下代码 ””
Sorry, something went wrong.
@Dxymiemiemie
提交喽,在test文件下我创了个对我model的测试,如果不加我对输出初始化修改,sigmoid层在forward时候应该会报错。如图所示 红框初始化能成功因为与他size相同的之前算子的共享空间。但是蓝色框的sigmoid算子初始化会失败,因为他在找不到能用的共享空间后只能用自己的输出形状创建。但是pnnx_operators,operators二者顺序差距较大,导致用的不是自己的shape。pnnx_operators的第275开始是transpose算子。
No branches or pull requests
你好叮咚工作室大佬们,我最近在采用KuiperInfer部署一个声音分类框架。在确定计算图的执行正确的情况下,我发现在输出空间初始化方面从某个节点开始出现了些问题。如图所示:
![network](https://private-user-images.githubusercontent.com/71275391/339968705-3c3f9aef-7acb-43fc-8879-524165afd2eb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUwMjk2ODMsIm5iZiI6MTcyNTAyOTM4MywicGF0aCI6Ii83MTI3NTM5MS8zMzk5Njg3MDUtM2MzZjlhZWYtN2FjYi00M2ZjLTg4NzktNTI0MTY1YWZkMmViLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODMwVDE0NDk0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIyMWZiMmE2NDVkZWNkNGFhZDQ2MDk0ZmY2M2I4ODY1NTczMjc5NTk5ODNlOTEzNzVjNWI5NGZmNjg5OWQ2ZDUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.J1ho8gQtswKPre9v_UhewK9GBWZienUXrDPfPVmjkkU)
输出空间初始化部分这几天看代码大概明白了一些,const std::vectorpnnx::Operator*& pnnx_operators,
const std::vector<std::shared_ptr>& operators
初始化时候为了提升内存效率,避免不必要的数据拷贝,可以对之前执行的节点的输出空间进行共享,这样既不会印象后继节点的输出还能对之前具有相同size的空间进行共用,具体体现在这里:
![屏幕截图 2024-06-15 170704](https://private-user-images.githubusercontent.com/71275391/339969731-212eb223-7268-4e9f-978b-70de7df532b2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUwMjk2ODMsIm5iZiI6MTcyNTAyOTM4MywicGF0aCI6Ii83MTI3NTM5MS8zMzk5Njk3MzEtMjEyZWIyMjMtNzI2OC00ZTlmLTk3OGItNzBkZTdkZjUzMmIyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODMwVDE0NDk0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM0NjdmNDk2MTI4NjY1MjZmOGZjZDkwYzMzNjhiOTEyYzlkMTM1Y2RhYTlkOTgzYTM1ZTIyMDU0MTYzNDAyYTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.odLo8rfOAJtoQv6wBGXiVtSxf12DOSrk2nc_Mg2IiPg)
不知道我的理解对吗?
![initoutput](https://private-user-images.githubusercontent.com/71275391/339969521-722213cc-e923-4480-a452-211189a35a4e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUwMjk2ODMsIm5iZiI6MTcyNTAyOTM4MywicGF0aCI6Ii83MTI3NTM5MS8zMzk5Njk1MjEtNzIyMjEzY2MtZTkyMy00NDgwLWE0NTItMjExMTg5YTM1YTRlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODMwVDE0NDk0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM3ZmM1YjdjZjg3Y2M0YTBmZjE5OTE0YTJkODlmMGMyMGQ2MzYyNWY1ZjNmMDFkNTQ0ZGYxOGQzZjM1ZTBlOTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.dG3FkLyvccU4XQSh_l4e4Fg882tryFipQYpO0O1qQ2k)
![fix](https://private-user-images.githubusercontent.com/71275391/339969209-56239841-9dce-4ab6-903c-66850b8a8818.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUwMjk2ODMsIm5iZiI6MTcyNTAyOTM4MywicGF0aCI6Ii83MTI3NTM5MS8zMzk5NjkyMDktNTYyMzk4NDEtOWRjZS00YWI2LTkwM2MtNjY4NTBiOGE4ODE4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODMwVDE0NDk0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc0MzlkYjIyZmExM2VmNDBlYTAwMjRhNmI3MmU3MjA0MDg1N2UwNTljZjAzZGJiOWJlMjRjNzNhMGU4MzBjZWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.QeYVC3yP_JG33AAKuWwZuRtoTsFN7EvdUXXxYW3KEks)
另外,我发现对于上图transpose节点后的计算图经过拓扑排序后,pnnx_operators,operators二者的顺序差距会非常大。这样多个并行的结构经过调试我发现初始化输出空间时候会因为顺序的原因导致初始化输出空间维度不对。
对此我加入了以下代码
这样操作保证在获取之前产生共享空间失败后使用初始化空间的shape与当前操作的算子输出空间shape一致。不知道我以上分析的是否正确,还望能一起讨论。
The text was updated successfully, but these errors were encountered: