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

Invalid arguments: DoubleTensor number FloatTensor #52

Closed
julien-c opened this issue Aug 26, 2016 · 7 comments
Closed

Invalid arguments: DoubleTensor number FloatTensor #52

julien-c opened this issue Aug 26, 2016 · 7 comments

Comments

@julien-c
Copy link

I'm moderately convinced that this is a neuralconvo issue per se, but in case it is:

/root/torch/install/share/lua/5.1/optim/adam.lua:59: invalid arguments: DoubleTensor number FloatTensor 
expected arguments: *DoubleTensor* [DoubleTensor] double | *DoubleTensor* [DoubleTensor] [double] DoubleTensor
stack traceback:
    [C]: in function 'add'
    /root/torch/install/share/lua/5.1/optim/adam.lua:59: in function 'adam'
    train.lua:131: in main chunk
    [C]: in function 'dofile'
    /root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
    [C]: at 0x00405d50

Any idea?

@zhaopku
Copy link

zhaopku commented Aug 28, 2016

I have the same problem. Did you train this on CPU? I think this may be a problem of CPU/GPU converting, the author wrote the codes for GPU but didn't adjust well for CPU. Have a look at this link:
sample.lua fails to run: error in function addmm()

@zhaopku
Copy link

zhaopku commented Aug 28, 2016

Problem solved!
Add this function to seq2seq.lua:

-- function Seq2Seq:double()
-- created by zhaopku to fix the problem of CPU mode
function Seq2Seq:double()
  self.encoder:double()
  self.decoder:double()

  if self.criterion then
    self.criterion:double()
  end
end

Then in train.lua:

at line 161:
change
model:float()
to
model:double()

@macournoyer
Copy link
Owner

Thx @zhaopku !

@julien-c
Copy link
Author

Thanks guys! Would it make sense to merge this to the codebase?

@hyeonseok92
Copy link

Thanks! It works for me!

@gravitymonkey
Copy link

Thanks, also works for me. Makes sense to merge (why not?)

@paularmand
Copy link

yes, working here too.
+1 for merge

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

6 participants