I built a custom filter in pytorch as shown below.

Screen Shot 2021-09-17 at 5.44.56 PM2482×526 65.1 KB

When using only one cpu or gpu, the code works fine, but when using dataparallel and model dataparallel, the code does not run.
Is there any way to solve the dataparallel problem in custom filter?
Screen Shot 2021-09-17 at 5.48.31 PM2726×992 333 KB