Skip to content

Conversation

@AtomAlpaca
Copy link
Contributor

主要改动:

  • pnnx 添加 inputinput2 参数,支持从 npy 文件获取输入 tensorshape 和内容

@github-actions
Copy link

github-actions bot commented Aug 10, 2025

The binary size change of libncnn.so (bytes)

architecture base size pr size difference
x86_64 15124728 15124728 0 😘
armhf 6155744 6155744 0 😘
aarch64 9453192 9453192 0 😘

@nihui
Copy link
Member

nihui commented Aug 21, 2025

感谢你的工作,请将你在实现中的笔记和心得,遇到的困难和解决方法等,记录成文章,发表在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

@tencent-adm
Copy link
Member

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ AtomAlpaca
❌ nihui
You have signed the CLA already but the status is still pending? Let us recheck it.

@nihui nihui requested a review from Copilot September 11, 2025 02:20
Copy link
Contributor

Copilot AI left a 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 input and input2 parameters 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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants