Giter VIP home page Giter VIP logo

capsnet-pytorch's Issues

Error

Hi! Thank you for your code. I got the error when I run your code. Can you help please to sort out the problem?
Traceback (most recent call last):
File "main.py", line 220, in
output = net(data)
File "/home/user/pytorch_python3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 224, in call
result = self.forward(*input, **kwargs)
File "main.py", line 71, in forward
return self.net(input)
File "/home/user/pytorch_python3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 224, in call
result = self.forward(*input, **kwargs)
File "/home/user/pytorch_python3/lib/python3.5/site-packages/torch/nn/modules/container.py", line 67, in forward
input = module(input)
File "/home/user/pytorch_python3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 224, in call
result = self.forward(*input, **kwargs)
File "main.py", line 120, in forward
u_hat = torch.matmul(torch.cat([self.W] * self.batch_size, 0) , input)
File "/home/user/pytorch_python3/lib/python3.5/site-packages/torch/functional.py", line 214, in matmul
expand_batch_portion = torch._C._infer_size(tensor1_exp_size[:-2], tensor2_exp_size[:-2])
RuntimeError: The size of tensor a (50) must match the size of tensor b (100) at non-singleton dimension 0.

感觉PrimaryCaps层,朋友你的理解和原文有点差异。

你的输出是8个1152为的胶囊,但是原文想表达的应该是1152个8维的向量,虽然整体标量个数一样,但是你的squash函数就成了对一个1152为的函数的作用了,文章肯定是希望对一个8维向量作用。个人拙见。

squeeze function

hi,i think you mix up mod and mod_sq in the squeeze function, it would be great that you check if i am right

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.