Sum with Axis 3D
import numpy as np
x = np.array([
[
[1,2],
[3,4]
],
[
[1,2],
[3,4]
]
])
x
array([[[1, 2],
[3, 4]],
[[1, 2],
[3, 4]]])
x.ndim
3
x[0]
array([[1, 2],
[3, 4]])
x[0][0]
array([1, 2])
x[0][0][0]
1
x.sum(axis=0)
array([[2, 4],
[6, 8]])
More
https://medium.com/@aerinykim/numpy-sum-axis-intuition-6eb94926a5d1