title: How to fit samples only to some of multiple outputs Keras Functional API
body: <p>I am currently stuck with the problem of trying to fit a functional keras model with 10 outputs and one input with samples that each have assignments to the outputs.</p>
  
  <p>Each sample has a list of 10 bools that indicate on which outputs this sample should be fitted.</p>
  
  <p>My current Model looks like this:</p>
  
  <pre><code>        inputs = Input(shape=(self.state_count,))
          # create the layers that learn the gane
          d1 = Dense(64, activation="relu", name="dense_1_shared",
                     kernel_initializer=keras.initializers.glorot_uniform(seed=int(time.time())))(inputs)
          d2 = Dense(64, activation="relu", name="dense_2_shared",
                     kernel_initializer=keras.initializers.glorot_uniform(seed=None))(d1)
          # create the heads that come on top of the gamelayers
          models = []
          heads = []
          for i in range(head_count):
              name = "head_{}".format(i)
              head = Dense(self.action_count, activation='relu', name=name,
                           kernel_initializer=keras.initializers.glorot_uniform(seed=None))(d2)
              heads.append(head)
              model = Model(input=inputs, output=head, name=("headmodel: {}".format(str(i))))
              model.compile(loss='mse', optimizer='adam')
              models.append(model)
          total_model = Model(input=inputs, output=heads, name="overall_modell")
          total_model.compile(loss='mse', optimizer='adam')
  
  </code></pre>
  
  <p>i am looking for a way to pass a list of masks alongside with the trainingset of x and y so that  only heads indicated by the mask get fitted on the corresponding x and y.</p>
  
  <p>Thanks in advance</p>