Closed HJ-harry closed 3 years ago
Thanks for the appreciation and for the detailed bug report. The python "frontend" of TorchRadon takes care of making inputs contiguous, the problem is that this functionality was not implemented into the gradient computation handlers. In your situation the gradient is non-contiguous (this is why you weren't able to solve the problem by adding contiguous()
) and this breaks the library.
I have pushed a fix to your problem, newly compiled binaries should be available after this build finishes (usually it takes 1 hour). Please wait for the build to finish and then install the library again.
Thanks for the report, Matteo
Thank you very much for the quick reply and the fix! :)
Now it works like a charm. Have a great day Hyungjin
Hi,
First of all thanks for the great library. It's very intuitive to use :+1:
However, I have an issue with
backward()
in torch not working after the forward projection, and some permutations to the result, due to the contiguousy issue.The task that I'm trying to do here deals with 3D objects, and I guess I can also do that since
torch-radon
supports batch dimensions. If I have a 3D object of shape(batch, channel, h, w, d)
, whereh
refers to height,w
refers to width, andd
refers to depth, I have to permute the dimensions before computing forward projection, and after the projection, the sinogram (or 2D projections in this case) will have the shape(d, N, det)
whereN
is the number of projection angles,det
is the number of detector pixels. For me to see this as multiple 2D projections, I need to permute the dimensions again so that it has the shape(batch, N, det, d)
. I have written a code which produces the same error I am encountering.Code
the helper functions are defined as below
For the Case 1, there is no error. However, if I run Case 2, I get the following error message.
I guess you usually solve this error with
contiguous()
, https://stackoverflow.com/questions/48915810/pytorch-contiguous and I've tried putting this to any possible places before and after transpose operations, but it still produce errors. Am I doing something wrong? Could you help me fix this issue?Thanks a lot in advance