UserWarning: The given NumPy array is not writeable

What you said is awesome, according to your method, I have solved the problem