I understand that the problem is that I redefine the parameter so I have to register it again to the optimizer.
Is it possible to resize a layer without redefining its parameters ? I tried to use resize_ but it did not work because the parameter reque.