Git Product home page Git Product logo

Comments (5)

christophetrinh avatar christophetrinh commented on April 28, 2024 2

I am very confused with the terms batch_size and n_steps. Does the lstm updates his parameters after n_steps ? In the recurrent network, the lstm is feed with a n_steps list of [batch_size,n_input]. So, in the case of the MNIST classification, the cell is feed with 128 samples of 28pixels every step in range(n_steps) ??

from tensorflow-examples.

aymericdamien avatar aymericdamien commented on April 28, 2024

It is working fine because it is using argmax of pred. Last layer of RNN example is a 10 dimension vector (for every label). So the predicted class is represented by that layer highest value index (that you get with argmax). Softmax is just used to squash values between 0 and 1.
Softmax is used while training because having a normalized probabilities distribution may help for better performances, but when predicting, softmax is actually not needed.

from tensorflow-examples.

aymericdamien avatar aymericdamien commented on April 28, 2024

It is hard to say without knowing your data, because network structure is also dependent of your data. If you are parsing words (ids), then your need to add an embedding layer.

from tensorflow-examples.

jakob-grabner avatar jakob-grabner commented on April 28, 2024

I also have a question to recurrent network. The RNN function returns only the last model output. return tf.matmul(outputs[-1], weights['out']) + biases['out'] which means the loss is also only calculated from the last output. One example in the Tensorflow repo (ptb_word_lm) uses the every output, not only the output of the last step. What is the right approach, or on what does it depend?

from tensorflow-examples.

aymericdamien avatar aymericdamien commented on April 28, 2024

It is because seq2seq is an encoding/decoding process that output a sequence, so calculating loss for every output is important. However in our example, we are simply doing classification over a whole sequence with a single output (predicted class), so only the last output is meaningful (which is the output after all timesteps have been 'processed').

from tensorflow-examples.

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.