... but changing the values of the numpy array works:
import numpy as np
def reshapeArray(arr):
arr = arr.reshape((2, 2))
arr /= 10
print(arr) # prints [[0.1 0.3], [0.2 0.4]]
arr = np.array([1, 2, 3, 4], dtype=np.float32)
reshapeArray(arr)
print(arr) # prints [0.1 0.2 0.3 0.4]
The reshapeArray() function changed values of the array permanently, but changed the shape of the array temporarily. If I add a return line (return arr) to end of the function, and assign the output of the function to the array (arr = reshapeArray(arr)), this time it works. But I wonder why it didn't work without returning the array?