I have a network -> net1 whose output is used to compute a mask, M.
The input (In2) to another network -> net2 is multiplied by this mask and then passed into the net2.
In2 = In2 * M
How do I train net1 using the output of net2? I cannot train them sequentially beacause there is a function between net1 and net2 that uses the output of net1 to compute a mask.
net1 -> mask_compute -> In2*M -> net2