This error is pretty rare since I have googled it and got nothing.
Could you remove the three float() in forward and try again? The data type in the whole neural network should be the same, at least I think so.