The code doesn’t crash on my machine with install from master. I’d suggest two things to try:

change mloss = loss * 0.01 + 0.99 * mloss to mloss = loss.data[0] * 0.01 + 0.99 * mloss

update to master

Could you try and see if these solve the issue?