from torch.utils.tensorboard import SummaryWriter import numpy as np # dummy data np_array = np.random.randn(100) # create a SummaryWriter object writer = SummaryWriter() # add histogram data writer.add_histogram("histogram_example", np_array, 0) # close the SummaryWriter object writer.close()In the above example, a NumPy array with random data is generated. A SummaryWriter object is then created, followed by the addition of the histogram data using the `add_histogram()` function. The tag name is set as "histogram_example" and the `global_step` parameter is set as 0. Finally, the SummaryWriter object is closed. Package library: `torch.utils.tensorboard` is a package component of PyTorch library.