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

clearState preserves structure in tables with Tensors #703

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

clearState preserves structure in tables with Tensors #703

wants to merge 1 commit into from

Conversation

funous
Copy link
Contributor

@funous funous commented Mar 9, 2016

When clearState is used on a table with tensors, it now preserves the structure (recursively) and creates a table with empty tensors.

self[f] = nil
local function clear(t)
if torch.isTensor(t) then
return t.new()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be t:set()? t.new() creates a new tensor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind, i read the comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that if #673 gets merged, we will be able to just call :set() on the tensors and keep all the references to the network tensors after clearState.

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

Successfully merging this pull request may close these issues.

3 participants