The reason why this happens is because of the way backward hooks are implemented for nn.Module.
Basically, the hook is done by attaching a hook on the output Variable of the module after the forward pass.
Since in your case the forward pass does not do anything, both hooks will be added to the same Variable during the forward pass. And so the first one added will be called first: the one corresponding to relu1 was added first and so is called first, the one corresponding to ef1 was added after and thus is called after.
Not sure if this is a bug or not…
cc: @apaszke do we want to fix this behaviour? Can we actually do it?