GithubHelp home page GithubHelp logo

Batch Embedding about keras HOT 3 CLOSED

keras-team avatar keras-team commented on May 3, 2024
Batch Embedding

from keras.

Comments (3)

fchollet avatar fchollet commented on May 3, 2024

Embedding layers work fine with batches (see the imdb_lstm.py example, where batch_size=16). Can you post your model and explain what you were trying to do?

from keras.

lemuriandezapada avatar lemuriandezapada commented on May 3, 2024

Sorry I'm new to this whole reporting thing, so please bear with me :)
I already changed the code I reported here to something else, but if you go to the imdb_lstm.py example and replace:

model.add(LSTM(256, 128))

with

model.add(Dense(256, 128))

you get this error, with batch sizes that are not equal to the second dimension of the dataset. Maybe I'm wrong but removing recurrency shouldn't affect the model's functionality so much.

But if you also go on and replace:

model.add(Embedding(max_features, 256))

with

model.add(Dense(maxlen, 256))

then it works. I suspect it's something about how the embedding layer indexes its vectors. But maybe I'm just missing something. Ideas?

from keras.

lemuriandezapada avatar lemuriandezapada commented on May 3, 2024

Nevermind, I figured it out eventually: moving from embedding/feedforward/recurrent requires a lot of reshape and flatten inbetween.

from keras.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.