I had a quick look at your code, and one thing that you should note is that you need the Sigmoid for the BCELoss, and it seems that you commented it out?
Also, it would be great if you could explain what kind of problems you are having: is the network not converging? are you getting worse results that your lasagne implementation? the network doesn’t learn at all?