The second error message seems to be a bit weird, as you are “only” trying to allocate ~500MB.
Could you check the RAM and are you really running out of memory?
The default data type of numpy is float64, so these float/double mismatches are often raised, if you don’t convert the numpy array to a FloatTensor (PyTorch uses float32 by default).