Thx, the guide works fine for the problem. However, there’s a new one. I attached the privacyengine to the optim, but when I ran the code, it reported a CUDA out of memory.
RuntimeError: CUDA out of memory. Tried to allocate 6.10 GiB (GPU 0; 23.70 GiB total capacity; 13.27 GiB already allocated; 3.20 GiB free; 18.51 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

So I then check the my graphics using nvidia-smi. I got 2 rtx3090 on the server, both available with 24gb memory. Then I ran the code with older opacus, basically the same but the way to attach privacyengine. The older one works.
Trace back reported something about backward() having trouble. Any idea?