No, there isn’t a way to speed this up, as you need to wait for the GPU to finish the loss calculation before you can print this value. In case the GPU isn’t finished yet, the print statement will wait for it.