Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Torch - Using optim package with CNN #155

Open
syamprasadkr opened this issue Apr 1, 2017 · 0 comments
Open

Torch - Using optim package with CNN #155

syamprasadkr opened this issue Apr 1, 2017 · 0 comments

Comments

@syamprasadkr
Copy link

I am trying to train a CNN using optim package. I am using this code, obtained from a video tutorial (see around 24:01), as a reference. This particular example uses a normal neural network. I also used this reference.

My code for the CNN can be found here. The problem is that if the input X is not a single image, I get an error:

In 14 module of nn.Sequential:
/home/ubuntu/torch/install/share/lua/5.1/nn/Linear.lua:57: size mismatch at /tmp/luarocks_cutorch-scm-1-1695/cutorch/lib/THC/generic/THCTensorMathBlas.cu:52

When I don't use GPU, the error becomes more clear:
size mismatch, [1024 x 2048], [409600]

I understand that the input to the first Linear layer is not 2048 when the input X has more than one image. But how does optim.sgd work properly with the entire training set used as input (X), in the case of the normal neural network given in first reference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant