cucim icon indicating copy to clipboard operation
cucim copied to clipboard

[FEA] More efficient gradient computation

Open grlee77 opened this issue 2 years ago • 1 comments

#340 proposed some minor improvements to gradient computation. However, I think there is still potential for a much stronger improvement. Specifically, by creating an custom ElementwiseKernel, we could write all gradient terms into an ndim + 1-dimensional output array during a single pass over the input image. That should be much more efficient than the repeated slicing operations as proposed here.

This could eventually be ported upstream for use in cupy.gradient as well.

grlee77 avatar Jul 28 '22 15:07 grlee77

We have 6 or 7 functions that call gradient directly and a number of others that call it indirectly, so this would be generally useful across the library.

grlee77 avatar Jul 28 '22 15:07 grlee77