DeprecationWarning: elementwise comparison failed; this will raise an error in the future

idx = np.where(label.cpu().numpy() == np.array([0]*data.cpu().shape[0]))[0]

I am tyring to perform elementwise comparison. However, getting the error.

 DeprecationWarning: elementwise comparison failed; this will raise an error in the future.
  idx = np.where(label.cpu().numpy() == np.array([0]*data.cpu().shape[0]))[0]

<__array_function__ internals>:180: DeprecationWarning: Calling nonzero on 0d arrays is deprecated, as it behaves surprisingly. Use `atleast_1d(cond).nonzero()` if the old behavior was intended. If the context of this warning is o
f the form `arr[nonzero(cond)]`, just use `arr[cond]`.
RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 8.00 GiB total capacity; 6.85 GiB already allocated; 0 bytes free; 7.30 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

Any help would be appreciated.

The DeprecationWarning is raised by numpy not PyTorch while the “Out of memory” error is raised by PyTorch if your GPU is running out of memory.
Try to decrease the memory usage by e.g. reducing the batch size.