CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
575 stars 189 forks source link

compatibility for pytorch autograd #580

Closed QuantPrincess closed 3 weeks ago

QuantPrincess commented 1 month ago

Will the Tigre modules (particularly forward projections) ever be torch autograd compatible? It would be great if we can track gradients throughout the forward projections. Thanks so much.

AnderBiguri commented 1 month ago

We are working on it, hoping I can tackle this in a month or two, but any help testing the current version welcomed : #563

That said, I also use tomosipo for this, as it works very well and it is quite fast, avoiding the memory swap that Tigre will anyways do. Making Tigre not do the memory swap is a harder task that I will likely won't have time to work on but I will happily help someone implement it.

QuantPrincess commented 1 month ago

Awesome thanks for the response and suggesting tomosipo in the mean time, happy to help testing current version mentioned in #563 On the off chance, do you know what the corresponding tomosipo geometry/volume settings might be for an average 2d cone beam projection of a (128x128 img)? I would ideally like to emulate your projection function with tomosipo so that I can use it in a pytorch gradient trackingsetting in addition to being able to use the projection for your implementation of FISTA reconstruction.

AnderBiguri commented 1 month ago

@QuantPrincess there is no "average projection", you just need to define a geometry in any case. Converting from one to the other is not too hard.