1
num_tags = 12  
num_words = 10000 
num_departments = 4  

title_input = keras.Input(
shape=(None,), name="title"
 )  
body_input = keras.Input(shape=(None,), name="body")  # Variable-length sequence of ints
tags_input = keras.Input(
shape=(num_tags,), name="tags"
) 

title_features = layers.Embedding(num_words, 64)(title_input)
body_features = layers.Embedding(num_words, 64)(body_input)

title_features = layers.LSTM(128)(title_features)
body_features = layers.LSTM(32)(body_features)

x = layers.concatenate([title_features, body_features, tags_input])

priority_pred = layers.Dense(1, name="priority")(x)
department_pred = layers.Dense(num_departments, name="department")(x)

model = keras.Model(
inputs=[title_input, body_input, tags_input],
outputs=[priority_pred, department_pred],
)

enter image description here

I want to make a separate call for priority and department to get one output instead of two. Is it possible to do that?

  • can't you just ignore the other one?, whats the use case? – BestDogeStackoverflow Jul 18 '22 at 09:26
  • I just want to build multiple models instead of a custom trainer I need to call the fit function to train all models and to get separate output. – Joshua Jenny Sibbu Jul 18 '22 at 09:45
  • we have 2 out of 3 inputs that contribute to one output and another set of inputs for the other output. So we may not have the third input when we want to predict the first output. training data (input_1,input_2, output_1) (input_2,input_3, output_2) – Joshua Jenny Sibbu Jul 18 '22 at 10:02

0 Answers0