I’m unsure what exactly you would like to change, as the code snippet seems to change a filter kernel (but doesn’t reassign it) while the description seems to target the change of an output activation.
In the latter case you could manipulate the activations in the forward method of your model and pass the changed one to the next layer.