-
Couldn't load subscription status.
- Fork 4.3k
Pnnx numpy file input #6244
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
base: master
Are you sure you want to change the base?
Pnnx numpy file input #6244
Conversation
|
The binary size change of libncnn.so (bytes)
|
|
感谢你的工作,请将你在实现中的笔记和心得,遇到的困难和解决方法等,记录成文章,发表在discussion分区,这将作为知识总结 https://github.com/Tencent/ncnn/discussions Thank you for your work. Please record your notes and experience in the implementation, difficulties encountered and solutions, etc. into an article and publish it in the discussion section. This will serve as a knowledge summary. https://github.com/Tencent/ncnn/discussions |
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for using numpy files as input data sources for the pnnx tool, enabling users to specify input tensor shapes and contents directly from .npy files instead of manually defining shapes.
- Adds
inputandinput2parameters to accept comma-separated numpy file paths - Implements numpy file parsing functionality with support for different endianness, data types, and array ordering
- Updates the torchscript loading process to use actual tensor data from numpy files when available
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/pnnx/src/utils.h | Adds function declarations for numpy file parsing utilities |
| tools/pnnx/src/utils.cpp | Implements numpy file parsing with endianness, fortran order, and data type handling |
| tools/pnnx/src/main.cpp | Adds command-line parameter parsing for input and input2 options |
| tools/pnnx/src/load_torchscript.h | Updates function signature to accept input content vectors |
| tools/pnnx/src/load_torchscript.cpp | Modifies tensor creation to use numpy data when available |
| tools/pnnx/tests/numpy/*.py | Test files demonstrating numpy input functionality |
| tools/pnnx/tests/numpy/CMakeLists.txt | Test configuration for numpy input tests |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
主要改动:
pnnx添加input和input2参数,支持从npy文件获取输入tensor的shape和内容