Userwarning: Numpy array not writable after coverting png image loaded using Pillow and tryping to covert to tensor

Seems the issue arose when converting to numpy array, is there a walk around to this instead making a copy of the array (since this will gave a huge overhead)?

The exact warning: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:141.)

PS: used the recommended method for conversion: convert_image_dtype(pil_to_tensor(img)) but again the issue isn’t here but the fact that pytorch seems to not be using numpy.array(img) for conversion.