def __array__(
        self, dtype: np.dtype[Any] | None = None
    ) -> npt.NDArray[Any]:
        """a.__array__([dtype], /)

        Returns either a new reference to self if dtype is not given or a new
        array of provided data type if dtype is different from the current
        dtype of the array.

        """
        numpy_array = self._thunk.__numpy_array__()
        if numpy_array.flags.writeable and not self._writeable:
            numpy_array.flags.writeable = False
        if dtype is not None:
            numpy_array = numpy_array.astype(dtype)
        return numpy_array
a.__array__([dtype], /)

        Returns either a new reference to self if dtype is not given or a new
        array of provided data type if dtype is different from the current
        dtype of the array.

        
cupynumeric/_array/array.py