Open iskandr opened 8 years ago
Thanks @iskandr. Any chance you can post a compilable model?
Hey @brianlow,
I tried to trim the code down to a manageable subset:
shared_embedding_layer = Embedding(
input_dim=20,
output_dim=64,
name="amino_acid_embedding")
def make_length_specific_model(
input_length,
shared_embedding_layer,
hidden_activation_function="tanh",
hidden_layer_sizes=[]):
input_layer = Input(
shape=(input_length,),
dtype="int32",
name="input_for_length_%d" % input_length)
x = Flatten()(shared_embedding_layer(input_layer))
for i, hidden_layer_size in enumerate(hidden_layer_sizes):
hidden_name = "hidden%d_for_length_%d" % (i + 1, input_length)
print("Making %s (size=%d)" % (hidden_name, hidden_layer_size))
x = Dense(size, name=name, activation=hidden_activation_function)(x)
output = Dense(
output_dim=1,
input_dim=hidden_layer_sizes[-1] if hidden_layer_sizes else shared_embedding_layer.output_dim * input_length,
activation="sigmoid",
name="output")(x)
model = Model(input=[input_layer], output=[output])
model.compile(optimizer='adam',
loss={'output': 'mse'},
loss_weights={'output': 1.})
return model
model_for_8mers = make_length_specific_model(8, shared_embedding_layer)
model_for_9mers = make_length_specific_model(9, shared_embedding_layer)
If you try to make a diagram for either of those models then you should get the same error.
Thanks, working on it.
I have a failing test but can't crack this one.
Not sure how to determine which input layer to include (currently it is trying to include both).
Does the the Keras visualization module handle this model? http://keras.io/visualization/
Keras shows the inputs for just one model (even if a layer has inputs coming into it from other models, they're ignored). That seems like reasonable behavior. Alternatively, providing a way to visualize the combined graph of multiple models with shared structure would be good too.
On Thu, Jul 14, 2016 at 11:30 PM, brianlow notifications@github.com wrote:
I have a failing test but can't crack this one.
Not sure how to determine which input layer to include (currently it is trying to include both).
Does the the Keras visualization module handle this model? http://keras.io/visualization/
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/brianlow/keras_diagram/issues/2#issuecomment-232851773, or mute the thread https://github.com/notifications/unsubscribe-auth/AAC9OVzI7XDqCWTy84bvUMM0qI71bMpMks5qVv7LgaJpZM4JKye4 .
I'm using a shared embedding layer between multiple lengths of sequence inputs and get the following error: