The MyReLU implementation is just an example in the tutorial and you could of course use the built-in nn.ReLU() module.
You would need to implement a custom autograd.Function e.g. if you are leaving PyTorch.
If you want to call the kappa method from sklearn, you would have to write the backward pass manaully.
However, if I’m not mistaken Cohen’s Kappa score is not contiguous and not differentiable, is it?
(There might be approximations which are differentiable, so you should check out the current research.)