Thanks @CarlZhang1020 for reporting the issue and the PR. See the modification in the PR for example of gradcam.
grad method changed in paddle2.4, need to check more code about grad process....grad-cam for example
Before solving this issue completely, we are suggesting using paddle2.3.2 currently.