Joshua Jenny Sibbu
Joshua Jenny Sibbu

Reputation: 51

Tensorflow functional API

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?

Upvotes: 1

Views: 51

Answers (0)

Related Questions