title: How to randomly set inputs to zero in keras during training autoencoder (callback)?
body: <p>I am training 2 autoencoders with 2 separate input paths jointly and I would like to randomly set one of the input paths to zero.</p>
  <p>I use tensorflow with keras backend (functional API).</p>
  <p>I am computing a joint loss (sum of two losses) for backpropagation.</p>
  <p>A -&gt; A' &amp; B -&gt;B'</p>
  <p>loss =&gt; l2(A,A')+l2(B,B')</p>
  <p>networks taking A and B are connected in latent space.
  I would like to randomly set A or B to zero and compute the loss only on the corresponding path, meaning if input path A is set to zero loss be computed only by using outputs of only path B and vice versa; e.g.:</p>
  <p>0 -&gt; A' &amp; B -&gt;B'</p>
  <p>loss: l2(B,B')</p>
  <p>How do I randomly set input path to zero? How do I write a callback which does this?</p>