mitsuba-renderer / drjit

Dr.Jit — A Just-In-Time-Compiler for Differentiable Rendering
BSD 3-Clause "New" or "Revised" License
563 stars 40 forks source link

Implement Gaussian Kernel on Image #240

Open LI-explorer opened 1 month ago

LI-explorer commented 1 month ago

Hi,

I'm wondering if there's a way to implement the Gaussian kernel for convolution on images using the current version of DrJit. While using a for loop is a straightforward approach, it can potentially hinder the backward process.

Do you have any suggestions or alternatives to efficiently integrate Gaussian kernel convolution without impacting the backward pass? Thanks.

njroussel commented 1 month ago

Hi @LI-explorer

I'm not sure I understand what the issue is. Do you mind sharing some code? I think it's perfectly acceptable to use a normal python loop here, unless the kernel is unusually large. The number of iterations of the loop is static and known beforehand. You should have no issues backpropagating when using a normal python loop.