Coder Social home page Coder Social logo

Comments (8)

AlexHex7 avatar AlexHex7 commented on June 19, 2024

It seems that b_IJ will be init to 0 each batch. Or each time when we invoke call function, the b_IJ will be create to 0. I'm not sure whether my opinion is right, I have not use tensorflow for a long time.

b_IJ = tf.constant(np.zeros([1, input.shape[1].value, self.num_outputs, 1, 1], dtype=np.float32))

from capsnet-tensorflow.

naturomics avatar naturomics commented on June 19, 2024

@AlexHex7 @pkubik AlexHex7 is right, b_IJ will be re-init to 0 at each batch, it's not shared between batches. Someone(not me) had done experiments about this problem and he told me it does work in that way.

from capsnet-tensorflow.

pkubik avatar pkubik commented on June 19, 2024

Oh, sorry @AlexHex7 @naturomics . I didn't formulate it correctly. I meant that it (b_IJ) is shared between all examples in a single batch. So I'm not sure whether it is correct to share b_IJ between different examples in the same batch.

from capsnet-tensorflow.

pkubik avatar pkubik commented on June 19, 2024

To be more specific what I suggest is to change the initialization of b_IJ to:
b_IJ = tf.constant(np.zeros([cfg.batch_size, input.shape[1].value, self.num_outputs, 1, 1], dtype=np.float32))
and remove the reduction from the last line of routing inner loop:
b_IJ += u_produce_v

from capsnet-tensorflow.

naturomics avatar naturomics commented on June 19, 2024

@pkubik I'm doing a experiment for this problem, please wait for the result of the experiment.

from capsnet-tensorflow.

naturomics avatar naturomics commented on June 19, 2024

@pkubik Now, I agree with you, though it makes the number of parameters b_IJ be batch_size-related, and experiment shows it doesn't make much difference. here is a related discussion for this problem, It might help us understand why

from capsnet-tensorflow.

Queequeg92 avatar Queequeg92 commented on June 19, 2024

Different sample, different object, different entities, so different b_ij. I'm wondering how much difference it makes@naturomics? Did you make the experiment on minist?

from capsnet-tensorflow.

naturomics avatar naturomics commented on June 19, 2024

@Queequeg92 Yeah, I did some experiments on mnist. It doesn't seem to make much difference in terms of classification accuracy. So I didn't release the corresponding result. Maybe trying it on the Fashion-MNIST that mentioned in issue #20 will see the difference, I will try it soon.

from capsnet-tensorflow.

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.