ivy icon indicating copy to clipboard operation
ivy copied to clipboard

feat: add lu_unpack function in Torch Frontend

Open p1utoze opened this issue 1 year ago • 1 comments

PR Description

The lu_unpack function is limited to scipy, torch and paddle. As there are no backend functions implemented yet in Experimental API, I have written a custom and generic unpack for the 2D LU matrix along with the conversion of pivot indices to permutation matrix. The multi-dimensional lu_unpack is a bit more complex and cluttered in the front-end function. It's better if it is implemented in the Experimental API.

Things to highlight:

  • Vectorizing pivot indices to permutation matrix may speed up computation but there are edge cases (repeated indices) in which results in mismatch from original torch.lu_unpack()
  • PyTorch lu unpack() supports only float and complex types

Related Issue

Closes #26225

Checklist

  • [x] Did you add a function?
  • [x] Did you add the tests?
  • [x] Did you run your tests and are your tests passing?
  • [x] Did pre-commit not fail on any check?
  • [x] Did you follow the steps we provided?

Socials

p1utoze avatar Oct 17 '23 17:10 p1utoze

Thank you for this PR, here is the CI results:


This pull request does not result in any additional test failures. Congratulations!

github-actions[bot] avatar Oct 17 '23 23:10 github-actions[bot]

closing, as the test fails. feel free to re-open if you get it working

Sam-Armstrong avatar Jul 11 '24 22:07 Sam-Armstrong