mmdeploy icon indicating copy to clipboard operation
mmdeploy copied to clipboard

Transfer to cpu only when torch.Tensor arguments in onnx export

Open take-cheeze opened this issue 1 year ago • 2 comments

Motivation

.cpu() in ONNX export inputs would be only supported in Tensor inputs so it should be only applied to Tensor types

Modification

Adds type checking before .cpu() and pass it directly if not.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a dependency on downstream projects of a newer version, this PR should be tested with all supported versions of downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

take-cheeze avatar Nov 19 '24 02:11 take-cheeze

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 19 '24 02:11 CLAassistant

If this MR doesn't get merged here, feel free to open it against our VBTI fork at https://github.com/VBTI-development/onedl-mmdeploy - we're actively maintaining updated versions with latest PyTorch support and would welcome the contribution!

lauriebax avatar Oct 21 '25 11:10 lauriebax