Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GenerateKeras produces empty list as output if Layers with multiple outputs are used #212

Open
umesh-timalsina opened this issue Oct 7, 2020 · 1 comment

Comments

@umesh-timalsina
Copy link
Contributor

umesh-timalsina commented Oct 7, 2020

GenerateKeras produces invalid model code if used on a model as shown in the figure below. Since, LSTM has multiple outputs, it is not able to assign any to the actual Model code.
image

The code generated is the following(Master Branch):

import keras
from keras.models import Model
from keras.layers import *


input2 = Input(shape=(None, 37), batch_shape=None, dtype=None, sparse=False, tensor=None)
input3 = Input(shape=(None, 37), batch_shape=None, dtype=None, sparse=False, tensor=None)
output, hidden_state, cell_state = LSTM(units=256, activation="tanh", recurrent_activation="hard_sigmoid", use_bias=True, kernel_initializer="glorot_uniform", recurrent_initializer="orthogonal", bias_initializer="zeros", unit_forget_bias=True, kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, dropout=0, recurrent_dropout=0, implementation=1, return_sequences=True, return_state=True, go_backwards=False, stateful=False, unroll=False)(inputs=input3)
output2, hidden_state2, cell_state2 = LSTM(units=256, activation="tanh", recurrent_activation="hard_sigmoid", use_bias=True, kernel_initializer="glorot_uniform", recurrent_initializer="orthogonal", bias_initializer="zeros", unit_forget_bias=True, kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, dropout=0, recurrent_dropout=0, implementation=1, return_sequences=False, return_state=True, go_backwards=False, stateful=False, unroll=False)(inputs=input2, initial_state=[hidden_state, cell_state])

custom_objects = {}


model = Model(inputs=[input3,input2], outputs=[])
result = model
model.custom_objects = custom_objects
@brollb
Copy link
Contributor

brollb commented Oct 21, 2020

Is there a test for this? (I thought you mentioned that there was one before but it might be nice to add it here as a comment.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants