Suppose I have the following data:
mask = [[0, 1, 1, 0, 1]] # 2D mask
ip_array = [[7, 4, 5, 2, 3]
[3, 2, 1, 9, 0]
[1, 8, 6, 3, 1]] # 2D array
I want to multiply the mask
with each row of ip_array
. So the output should be like:
[[0, 4, 5, 0, 3]
[0, 2, 1, 0, 0]
[0, 8, 6, 0, 1]]
I am new to numpy functions and I am looking for an efficient way to do this. Any help is appreciated!