Gradient masking in register_backward_hook for custom connectivity - efficient implementation

I’ll let myself call the guys from the similar topic, hopefully that’s fine.
@theQmech, @bzcheeseman, @shirindora, @mariob6, did you have any luck for implementing this? Could you provide some hints?
Thank you in advance.