An invalid argument error is usually not raised if you are running out of memory.
Do you remember which operation raised it when you saw the stack trace (in case you were running with CUDA_LAUNCH_BLOCKING=1)?