Both approaches are correct. The parent is talking about Ablation based importance attribution whereas you’re using gradients to assign importance.
Your approach will compute pixel importance in a single step whereas ablation based approaches generally need many passes.