torch.manual_seed(42)
t = torch.randn(100000)+3
plot(t)π View as a histogram
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:
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);