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

have torch.class return the class if already defined, rather than raise error #1

Open
eulerreich opened this issue Oct 22, 2015 · 1 comment

Comments

@eulerreich
Copy link

Right now if I modify a module like nn.Normalize, and want to reload this in iTorch, I get an error saying it's already defined (if I have required 'nn' already).

My current workaround is something like this at the beginning of the file.

local Normalize, parent                                                                                                                        
if nn.Normalize == nil then                                                                                                                    
    Normalize, parent = torch.class('nn.Normalize', 'nn.Module')                                                                               
else                                                                                                                                           
    Normalize = nn.Normalize                                                                                                                   
    parent = nn.Module                                                                                                                         
end 

This is fine, except that every time I want to push to nn I'd have to revert this back to the original code. So is there any safety issues with not defaulting torch.class to return the already defined class?

@oeway
Copy link

oeway commented Feb 16, 2016

+1
It's annoying when I do prototyping in itorch notebook.

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

2 participants