I had to design a loss function max(0,x). It's not differentiable at x=0. In order to train it with gradient descent, what should I do?
- I have learned that subgradient can be used instead, so does it need to be changed in the code, or will pytorch/tf calculate subgradient automatically?
- Or use surrogate loss, so what kind of surrogate loss is there for my loss?