pnnx input npy files (libnpy-based) #6239
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
目的
腾讯开源课题实战:ncnn task1 (pnnx input npy files)
提交时间:2025/8/7
提交者:江南大学-鲁天硕
改动
npy.hpp头文件至pnnx/src项目主文件夹;pnnx::Graph::bind_operand接口:用于解析导入.npy文件数据,将其绑定到pnnx_graph的指定(名字name或索引index)operand上,具体数据保存在operand.params["__data__"]中(兼容结构体);main函数内,bind于pnnx::pass_level2之前执行;main函数内,添加参数input=a.npy,...的解析过程(复用parse_string_list接口);接口
path: 需要解析的文件地址(解析模式{...}/${name}.{suffix},其中suffix可为npy,bin等等格式进行进一步拓展解析);index:${name})。graph.operand[index];return:-1解析报错,0其他。测试
step1: 模型pt & 输入npy 生成
resnet18.pt与a.npy:step2: 测试改动功能