EIDOSLAB / torchstain

Stain normalization tools for histological analysis and computational pathology
MIT License
118 stars 20 forks source link

Support for torch.linalg.lstsq #32

Closed raphaelattias closed 1 year ago

raphaelattias commented 1 year ago

First time opening an issue, so I apologize if the approach is not correct.

I was getting an issue with pytorch 1.13, when torch.lstsq in line 52 of macenko.py for torch was replaced recently by torch.linalg.lstsq.

Naively changing torch.lstsq to torch.linalg.lstsq would throw an error at line 106.

The correct approach is to make the following change at line 52:

torch.lstsq(Y, HE)[0][:2] to torch.linalg.lstsq(HE, Y)[0]

I will do a Pull request to solve this issue, I hope this post can help!

andreped commented 1 year ago

I have observed the same. Just haven't had the time to work on the pytorch stuff revently. Just note that you will need to add a fix that is backwards compatible.

Our unit tests failed on the recent PRs due to this exactly this issue. Hence, a PR would be great! :]

raphaelattias commented 1 year ago

Great, thank you! What's the easiest way to contribute to the repo? I have created a branch locally to solve the issue, but because of access rights, I can not push it or start a PR.

andreped commented 1 year ago

You have to fork the repo first, then make a branch in the fork (ideally), commit to the branch (in the fork), and then you can make a PR.