Given that arr- 4d, and yours fnworks on 3d arrays,
np.asarray(map(func, arr))
. ,
np.asarray([func(i) for i in arr])
for i in arr arr. arr . 4d-.
np.vectorize doc , . , . , np.vectorize . , , -
[func(a,b) for a,b in zip(arrA, arrB)]
zip, . . func, .
np.vectorize np.frompyfunc, , . func.
np.apply_along/over_ax(e/i)s . , , .
, :
In [45]: res=np.zeros_like(arr,int)
In [46]: for i in range(arr.shape[0]):
...: res[i,...] = f(arr[i,...])
, , .
, , .
========================
1- :
In [58]: arr.__array_interface__['data'] # data buffer address
Out[58]: (152720784, False)
In [59]: for i,a in enumerate(arr):
...: print(a.__array_interface__['data'])
...: a[0,0,:]=i
...:
(152720784, False) # address of the views (same buffer)
(152720892, False)
(152721000, False)
In [60]: arr
Out[60]:
array([[[[ 0, 0, 0],
[ 3, 4, 5],
[ 6, 7, 8]],
...
[[[ 1, 1, 1],
[30, 31, 32],
...
[[[ 2, 2, 2],
[57, 58, 59],
[60, 61, 62]],
...]]])
, , . , a[:]=..., . . a = ...., .