torch.cuda.memory cache has been renamed to torch.cuda.memory reserved code example Example: pytorch get gpu number torch.cuda.device_count()