Code Monkey home page Code Monkey logo

Comments (4)

TolicWang avatar TolicWang commented on August 11, 2024

Actually, any model in Tensorflow, as far as I know, different batch size can not be setted whatever in training or in inference process. Hence, I suggest that you can set the batch size in tf.placeholder with None, which will avoid this problem you suffered.

from rnn.

TonyGongjc avatar TonyGongjc commented on August 11, 2024

Thanks for your quick reply. More specifically, starting from Line 90 in ConvLSTM.py (peephole part), 'w_ci' is defined by vs.get_variable("w_ci", cell.shape, inputs.dtype), which results in shape [512, 7, 7, 128] during training, and 512 is the batch size I set in this case. However if I set batch size to 1000 during inference, the shape of 'w_ci' will change to [1000, 7, 7, 128], which, will fail because this is not consistent with the training shape.

Apparently the first dimension of 'w_ci' cannot be None or -1 in this case otherwise the variable cannot be created. However once the variable is created, the shape is also fixed, which leads to unchangeable batch size.

If I set off the peephole mode, this problem will not appear which means I can set different batch size. So this problem is a little bit weird to me. I will try fixing it.

from rnn.

TolicWang avatar TolicWang commented on August 11, 2024

Thanks for your reminder. After check carefully, it should be a vital bug. And it has been debuged as follow:

            kernel_shape = cell.shape.as_list()[-3:]
            w_ci = vs.get_variable(
                "w_ci", kernel_shape, inputs.dtype)
            w_cf = vs.get_variable(
                "w_cf", kernel_shape, inputs.dtype)
            w_co = vs.get_variable(
                "w_co", kernel_shape, inputs.dtype)

You can change your code in your project, and if there is any problem, please feel free to contact me.

from rnn.

TonyGongjc avatar TonyGongjc commented on August 11, 2024

Everything looks well! Thanks for your help!

from rnn.

Related Issues (2)

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.