I am using some forward hooks on intermediate layers for debugging/visualisation purposes and I am wondering if it is possible to execute the “hook” code only on each n-th batch? In other words is there any global modifier which toggles hook execution on and of?