Imagine we have the following 3D array:
[[[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[1, 2, 1],
[0, 0, 0],
[4, 2, 1]],
[[0, 0, 0],
[1, 1, 3],
[0, 0, 0]]]
I want to reduce the dimension of the array and obtain True or False whenever each element in axis=2 is different or equal to [0, 0, 0], respectively.
Desired 2D output for the previous example array:
[[False, False, False]
[True, False, True],
[False, True, False]]
We pass from 3x3x3 int/float array to a 3x3 boolean array.