rich7420 opened a new pull request, #820:
URL: https://github.com/apache/mahout/pull/820

   ### Purpose of PR
   <!-- Describe what this PR does. -->
   Now we make multiple copy in pytorch import like: torch.Tensor -> tolist() 
-> Vec<f64>.
   This PR replaced the tolist() approach with zero-copy conversion using PyO3 
NumPy interface:
   - Convert PyTorch tensor to NumPy view via tensor.detach().numpy() 
(zero-copy when C-contiguous)
   - Extract &[f64] slice directly using PyReadonlyArrayDyn<f64>::as_slice()
   - Eliminates intermediate Python list and Rust Vec allocations
   
   Otherwise, this pr provide a benchmark to test latency of pytorch.
   We could remove the benchmark if you think it's unnecessary.
   
   ### Related Issues or PRs
   <!-- Add links to related issues or PRs. -->
   <!-- - Closes #123  -->
   <!-- - Related to #123   -->
   
   ### Changes Made
   <!-- Please mark one with an "x"   -->
   - [ ] Bug fix
   - [ ] New feature
   - [x] Refactoring
   - [ ] Documentation
   - [ ] Test
   - [ ] CI/CD pipeline
   - [ ] Other
   
   ### Breaking Changes
   <!-- Does this PR introduce a breaking change? -->
   - [ ] Yes
   - [x] No
   
   ### Checklist
   <!-- Please mark each item with an "x" when complete -->
   <!-- If not all items are complete, please open this as a **Draft PR**.
   Once all requirements are met, mark as ready for review. -->
   
   - [x] Added or updated unit tests for all changes
   - [ ] Added or updated documentation for all changes
   - [x] Successfully built and ran all unit tests or manual tests locally
   - [ ] PR title follows "MAHOUT-XXX: Brief Description" format (if related to 
an issue)
   - [ ] Code follows ASF guidelines
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to