Is there a way to make a model that creates a mask to drop certain inputs before feeding the masked data to another network?
This might be a question that is kind of dumb but I'm trying to construct a model that is able to filter out inputs before feeding the filtered output to another network.
For example, I have an image that I would to match with a database of about 100 pictures, then I would apply the first network to do some operations that would output the top 10 pictures that is most likely to correctly match. Afterwards, I would apply a second network to rematch those top 10 pictures using a secondary network.
INPUT --&gt; | NETWORK 1 | --&gt; FILTERED OUTPUT --&gt; | NETWORK 2 | --&gt; FINAL OUTPUT

Wondering if there is a way to accomplish this sort of filtration behaviour where that filtered output is fed to the second model like that.

You could maybe take a look at Boolean index arrays with numpy
    &gt;&gt;&gt; import numpy as np
    &gt;&gt;&gt; x = np.array(range(20))
    &gt;&gt;&gt; x
    array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 
    10, 11, 12, 13, 14, 15, 16, 17, 18, 19])
    &gt;&gt;&gt; x[x &gt; 10]
    array([11, 12, 13, 14, 15, 16, 17, 18, 19])

x &gt; 10 returns an array with 20 booleans, so you can maybe try something like this:
    x = pic_arr[network1(pic_arr)]
    network2(x)
  

Where pic_arr is an array with your pictures and network1 returns a list with booleans of which pictures to select.
