I wrote simple script which converts a lasagne model (saved in h5 format) to a pytorch model (the architecture has only convolutional layers - https://github.com/madratman/lasagne_to_pytorch/blob/master/convert_lasagne_to_pytorch.py), but am getting erroneous (read blank) predictions
I also was checking the model weights of https://github.com/Lasagne/Recipes/blob/master/modelzoo/vgg16.py) and comparing them to torch vision’s vgg16, and saw that after the 2nd conv layer, the mean weight of each conv layer is different by an order of 10.
I guess for VGG, it’s due to different input ranges (in pytorch, it’s 0-1 and in lasagne, it’s just subtraction from mean image but not scaling to 0-1)
But for my architecture, I fail to understand how could the two give different results.
The code is here https://github.com/madratman/lasagne_to_pytorch/blob/master/convert_lasagne_to_pytorch.py
model in lasagne https://github.com/madratman/lasagne_to_pytorch/blob/master/models/lasagne/dilated_3.py
model in pytorch https://github.com/madratman/lasagne_to_pytorch/blob/master/models/pytorch/dilated_3.py
Could a reason be that torch and lasagne have different ways to add relu?! (lasagne allows it as an option in the conv layer itself.)
I won’t mind writing a generic model converter if I get past this