I have a 3d volume HxWxD and I want to compute the mean only for values that are non zero along the D dimension to obtain a 2d HxW mea
HxWxD
D
HxW