I get the expected result:
 > CUDA memory: 19.000017166137695 GiB
CUDA out of memory. Tried to allocate 9.00 GiB (GPU 0; 23.69 GiB total capacity; 19.00 GiB already allocated; 1.48 GiB free; 19.00 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
 > CUDA memory: 0.0 GiB

but think that these “hacks” might easily fail (as seen in your setup) and would thus recommend to set a proper batch size before starting the training.
In any case, you could check if deleting out (if it’s even created) might solve your issue.