lovely-tensors
  1. πŸ”Ž Tensor representations
  2. πŸ“Š View as a histogram
  • ❀️ Lovely Tensors
  • πŸ”Ž Tensor representations
    • 🧾 View as a summary
    • πŸ–ŒοΈ View as RGB images
    • πŸ“Š View as a histogram
    • πŸ“Ί View channels
  • ✨ Misc
    • πŸ€” Config
    • πŸ™‰ Monkey-patching
    • 🎭 Matplotlib integration
    • πŸ“œ IPython’s history obsession

On this page

  • plot
  1. πŸ”Ž Tensor representations
  2. πŸ“Š View as a histogram

πŸ“Š View as a histogram


source

plot


def plot(
    x:Tensor, # Tensor to explore
    center:str='zero', # Center plot on  `zero`, `mean`, or `range`
    max_s:int=10000, # Draw up to this many samples. =0 to draw all
    plt0:Any=True, # Take zero values into account
    ax:Optional=None, # Optionally provide a matplotlib axes.
)->PlotProxy:
torch.manual_seed(42)
t = torch.randn(100000)+3
plot(t)

plot(t, center="range")

plot(t, center="mean")

plot(torch.nn.functional.relu(t-3))

plot(torch.nn.functional.relu(t-3), plt0=False)

fig, ax, = plt.subplots(figsize=(6, 2))
fig.tight_layout()
plot(t, ax=ax);