question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi, I am having problems plotting histograms. I think there is a very good chance that it is not because of a bug in tensorboard-pytorch, but I’m not sure what I could be doing wrong, and I’m not sure where to ask, so if someone could help I would appreciate it.

I am trying to plot histograms of the gradients like this:

loss.backward()
for n, p in filter(lambda np: np[1].grad is not None, spectral_model.named_parameters()):
    print(n, p.grad.data.min(), p.grad.data.max())
    summary_writer.add_histogram(n, p.grad.data.cpu().numpy(), global_step=step)

The mins and maxes show that the values are all between -.15 and .15 (and in fact most values are much closer to zero than that). But the histograms seem to show that all the values are located at one extremely high value, like 3.01e+18:

image

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
greabercommented, Oct 16, 2017

Thanks. For now I guess I will just stick to ‘doane’ since I don’t want to hand set the binning for each parameter. Actually, I am finding the distributions tab more useful than the histograms tab for my puproses anyway (basically I am interested in monitoring spiking gradients that require clipping and maybe also gradients going to zero). We can close this issue if you want. There is definitely some buggy behavior with the default binning, but if tensorboard is doing the binning by default I guess it is probably a tensorboard issue.

0reactions
lanpacommented, Oct 16, 2017

Using auto will explode the memory (should be numpy bug). see #1 . From you last graph, I think bins=np.arange(-0.003, 0.003, 0.0001) might do the work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Misleading histograms - Andrey Akinshin's blog
A series of properly constructed histograms may create a false sense of security. However, one day you may try to build a histogram...
Read more >
Bad "Histograms" - GeoGebra
Last updated 2/20/2020 There is something wrong with each of the "histograms" shown. Move the slider to select a new problem.
Read more >
6 Reasons Why You Should Stop Using Histograms (and ...
So, What's Wrong With the Histogram? · 1. It depends (too much) on the number of bins. · 2. It depends (too much)...
Read more >
How Histograms Can Misrepresent Statistical Data - dummies
The y-axis of a histogram shows how many observations are in each group, using counts or percentages. A histogram can be misleading if...
Read more >
Question Video: Identifying Mistakes in a Given Histogram
... members of a cycling club over a long-distance race. David drew a histogram to represent this data. What is the mistake in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found