The loss curves look alright.
I’m not familiar with your code and cannot comment on the correctness of some operations such as output[target == 0] = 0 etc., but it looks generally alright (besides the usage of Variable  ).