Skip to content

Error using lambda layers #3

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

Open
Jbiloki opened this issue Jan 8, 2019 · 1 comment
Open

Error using lambda layers #3

Jbiloki opened this issue Jan 8, 2019 · 1 comment

Comments

@Jbiloki
Copy link

Jbiloki commented Jan 8, 2019

           OPERATION           DATA DIMENSIONS   WEIGHTS(N)   WEIGHTS(%)

               Input   #####     72  300
          InputLayer     |   -------------------         0     0.0%
                       #####     72  300
               Dense   XXXXX -------------------     15050    92.0%
                       #####     72   50
          InputLayer     |   -------------------         0     0.0%
                       #####     72    3
         Concatenate   ????? -------------------         0     0.0%
                       #####     72   53
                LSTM   LLLLL -------------------      1180     7.0%
                tanh   #####           5
              Lambda   ????? -------------------         0     0.0%
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-222-96aac99b2755> in <module>()
----> 1 keras2ascii(lstm_model)

/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/keras_sequential_ascii/main.pyc in sequential_model_to_ascii_printout(model, sparser, simplify, header)
    123 
    124 def sequential_model_to_ascii_printout(model, sparser=False, simplify=True, header=True):
--> 125     print_layers(jsonize(model), sparser=sparser, simplify=simplify, header=header)

/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/keras_sequential_ascii/main.pyc in print_layers(jsonized_layers, sparser, simplify, header)
    118         print(data_template.format(
    119                 activation=each["activation"] if each["activation"] != "linear" else "",
--> 120                 shape=print_dim_tuple(each["output_shape"]),
    121                 # length=product(each["output_shape"])
    122         ))

/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/keras_sequential_ascii/main.pyc in print_dim_tuple(t)
     83         return " ".join(["{:4d}".format(x) for x in t])
     84     else:
---> 85         return  "{:9d}".format(t[0])
     86 
     87 def print_layers(jsonized_layers, sparser=False, simplify=False, header=True):

IndexError: tuple index out of range

For model:

x = Input(shape=(72,300))
aux_input = Input(shape=(72, 3))
probs = Input(shape=(1,))
dim_reduct = Dense(50)(x)
cat = concatenate([dim_reduct, aux_input])
encoded = LSTM(5)(cat)
#cat2 = concatenate([encoded, probs])
#output = Dense(1, activation='linear')(encoded)

output = Lambda(lambda x: K.sum(x, axis=1))(encoded)

@stared
Copy link
Owner

stared commented Jan 10, 2019

@Jbiloki Thanks for brining this up. Though, I no longer develop the project. (Mostly, as it is restricted to a small subset of network architectures.)

For wider inspirations, see:
https://medium.com/inbrowserai/simple-diagrams-of-convoluted-neural-networks-39c097d2925b

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

No branches or pull requests

2 participants