Let`s assume that we created a numpy array with views on another array using stride tricks:
import numpy as np
from numpy.lib import stride_tricks
x = np.arange(20).reshape([4, 5])
arr = stride_tricks.as_strided(x, shape=(3, 2, 5),strides=(20, 20, 4))
We can confirm that this new array is indeed a view:
assert not arr.flags['OWNDATA']
# True
Question:
If I pass arr
as an argument into multiprocessing.Process()
will arr
be copied into each process ? Will x
be copied ? Please explain why.