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

Several *Table modules lack type() method #168

Closed
mys007 opened this issue Feb 18, 2015 · 3 comments
Closed

Several *Table modules lack type() method #168

mys007 opened this issue Feb 18, 2015 · 3 comments

Comments

@mys007
Copy link
Contributor

mys007 commented Feb 18, 2015

Several *Table modules (e.g. JoinTable or CAddTable) store tables in their gradInput member variable but define no appropriate type(type) method. This leads to the issue that a model cannot change type (e.g. float<->cuda) once a backpropagation has been performed. The proposed fix is to define the method appropriately, e.g.

function CAddTable:type(type)
   parent.type(self, type)
   self.gradInput = {}
end
@nicholas-leonard
Copy link
Member

They inherit it from Module:
https://github.com/torch/nn/blob/master/Module.lua#L130
which uses recursiveType:
https://github.com/torch/nn/blob/master/Module.lua#L116

So this shouldn't be an issue?

@mys007
Copy link
Contributor Author

mys007 commented Feb 18, 2015

Oh, of course, that should work. My apology, I was on the getParamsByDevice branch, which is missing this functionality.

@mys007 mys007 closed this as completed Feb 18, 2015
@soumith
Copy link
Member

soumith commented Feb 19, 2015

I'll rebase that branch to master tomorrow, sorry about that @mys007

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

3 participants