mitsuba-renderer / drjit

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

Implement Gaussian Kernel on Image #240

Closed LI-explorer closed 2 months ago

LI-explorer commented 4 months 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 4 months 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.