Compute per sample gradient for a normal model

Hello, How to compute a per sample gradient for a usual model using Opacus? In this case, we don’t care about the privacy issue.


Excellent question. We recently wrote a blog about this: Differential Privacy Series Part 2 | Efficient Per-Sample Gradient Computation in Opacus | by PyTorch | PyTorch | Sep, 2021 | Medium