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

Error in Accessing Layers of Word Embedding model #20

Open
Anacoder1 opened this issue Sep 9, 2019 · 1 comment
Open

Error in Accessing Layers of Word Embedding model #20

Anacoder1 opened this issue Sep 9, 2019 · 1 comment

Comments

@Anacoder1
Copy link

In this code, in the "Get word embeddings" section of the "Skip-gram model", the code is as follows:

merge_layer = model.layers[0]
word_model = merge_layer.layers[0]
word_embed_layer = word_model.layers[0]
weights = word_embed_layer.get_weights()[0][1:]

The above code gives the error as

AttributeError: 'InputLayer' object has no attribute 'layers'

The following code should be inserted in place of the above code (it works perfectly):

word_embed_layer = model.layers[2]
weights = word_embed_layer.get_weights()[0][1:]

@Sinchit
Copy link

Sinchit commented Apr 14, 2021

Thanks

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