TIGRE icon indicating copy to clipboard operation
TIGRE copied to clipboard

Fix numpy memory order issue

Open pjueon opened this issue 1 year ago • 1 comments

  • fix for #399 (not only Ax, but also all the cuda-numpy interface functions potentially have the same issue.)
  • the memory order of the numpy arrays must be c-contiguous
  • numpy.ascontiguousarray returns a contiguous array. Deep copy only occurs if the memory order is not c-contiguous.

I didn't added it but you can also add warnings when the deep copy occurs by checking if img.flags['C_CONTIGUOUS'] if you want.

pjueon avatar Sep 06 '22 13:09 pjueon

@AnderBiguri Please let me know your thoughts. Adding the warning option might be a good idea I think.

pjueon avatar Sep 14 '22 23:09 pjueon

This looks good. I though about the warnings, and while its a good idea, I am not entirely sure where to put them... It should never happen inside algorithms anyway, so maybe we can just forget the warnings, its quite an edge case that the user will not have enough memory.

AnderBiguri avatar Sep 27 '22 13:09 AnderBiguri