wiiiktor:

The problem is that the layer ‘hinge’ does not learn anything, so my network does not become better and better


That is because you have not asked it to learn anything. Your code does only a forward pass through the ‘hinge’ layer. For the layer to learn, you need to (i) define a loss function which tells how bad the computed output is with respect to the expected output, and (ii) do a backward pass so that the knowledge from (i) is taught to the model.
This is a good tutorial on how to teach a model in PyTorch.