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

why do you use clone in histogram examples? #41

Closed
greaber opened this issue Oct 15, 2017 · 1 comment
Closed

why do you use clone in histogram examples? #41

greaber opened this issue Oct 15, 2017 · 1 comment

Comments

@greaber
Copy link
Contributor

greaber commented Oct 15, 2017

From the readme,

for name, param in resnet18.named_parameters():
            writer.add_histogram(name, param.clone().cpu().data.numpy(), n_iter)

Could we instead use the following simpler version?

for name, param in resnet18.named_parameters():
            writer.add_histogram(name, param.data.cpu().numpy(), n_iter)

(Or we could put the .cpu() before the .data probably -- I don't think this matters.)

@lanpa
Copy link
Owner

lanpa commented Oct 15, 2017

Instead you can use writer.add_histogram(name, param, n_iter) if you use latest tensorboardX (see demo.py). I forget to update readme.

@lanpa lanpa closed this as completed Oct 17, 2017
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