How to customize the double backward?

Hi, SimonW, I am still a bit confusing. Could you please give some pseudocode about this? Thank you very much.