I want to mask an array of pixels with an array of ones and zeros. I'm using Keras in graph mode, so only using operations that can be performed on tensors.
Most symbolic operators seem to work in graph mode, and there is a subset of numpy operations in keras.backend. But there is no support for no iterating or enumerating.
So for example I have:
arr = [[(1,2,3),(2,3,4),(4,5,6)],[(5,6,7),(6,7,8),(7,8,9)]]
mask = [[1, 0, 1],[0, 0, 1]]
# and I want
arr * mask == [[(1,2,3),(0,0,0),(4,5,6)],[(0,0,0),(0,0,0),(7,8,9)]]
The actual arrays are images, so much bigger than this example. Is there a reasonable way to mask points like this?