Whoops, I guess not. That’s a little embarrasing, should I change the title of the post?
If I use the alternative backward hook function
def backward_use_act(name, module, grad_input, grad_output):
    print('___Backward pass for '+str(name)+'___')
    print('Grad_input needed to be overwritten: '+str(grad_input))
    grad_tuple = (grad_input[0],)
    print('New grad input: '+str(grad_tuple))
    return(grad_tuple)

I also get an error, when the backprop reaches s1

Backward pass for s2
Grad_input needed to be overwritten: (tensor([0.0753]),)
New grad input: (tensor([0.0753]),)
Traceback (most recent call last):
File “”, line 46, in 
out.backward()
File “/Users/Eigil/opt/anaconda3/lib/python3.7/site-packages/torch/tensor.py”, line 195, >in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File “/Users/Eigil/opt/anaconda3/lib/python3.7/site->packages/torch/autograd/init.py”, line 99, in backward
allow_unreachable=True)  # allow_unreachable flag
File “”, line 28, in backward_use_act
print(‘Backward pass for '+str(name)+'’)
SystemError: <class ‘str’> returned a result with an error set

However, I get no error, if I don’t include the return-call:
def backward_use_act(name, module, grad_input, grad_output):
    print('___Backward pass for '+str(name)+'___')
    print('Grad_input needed to be overwritten: '+str(grad_input))
    grad_tuple = (grad_input[0],)
    print('New grad input: '+str(grad_tuple))


Backward pass for s2
Grad_input needed to be overwritten: (tensor([0.0753]),)
New grad input: (tensor([0.0753]),)
Backward pass for s1
Grad_input needed to be overwritten: (tensor([0.0034, 0.0296]),)
New grad input: (tensor([0.0034, 0.0296]),)

I do not understand this behavior. In this instance, the return-objects are identical to the computed grad_input, but errors are still raised?