class_docstr: The user-facing class that provides metric storage functionalities.
  
  In the future we may add support for storing / logging other types of data if needed.
docstr: Create a histogram from a tensor.
  
  Args:
      hist_name (str): The name of the histogram to put into tensorboard.
      hist_tensor (torch.Tensor): A Tensor of arbitrary shape to be converted
          into a histogram.
      bins (int): Number of histogram bins.
docstr_tok: ["Create","a","histogram","from","a","tensor",".","Args",":","hist_name","(","str",")",":","The","name","of","the","histogram","to","put","into","tensorboard",".","hist_tensor","(","torch.Tensor",")",":","A","Tensor","of","arbitrary","shape","to","be","converted","into","a","histogram",".","bins","(","int",")",":","Number","of","histogram","bins","."]
code: def put_histogram(self, hist_name, hist_tensor, bins=1000):
      """
      Create a histogram from a tensor.
  
      Args:
          hist_name (str): The name of the histogram to put into tensorboard.
          hist_tensor (torch.Tensor): A Tensor of arbitrary shape to be converted
              into a histogram.
          bins (int): Number of histogram bins.
      """
      ht_min, ht_max = (
          hist_tensor.min().item(),
          hist_tensor.max().item(),
      )
  
      # Create a histogram with PyTorch
      hist_counts = torch.histc(hist_tensor, bins=bins)
      hist_edges = torch.linspace(
          start=ht_min, end=ht_max, steps=bins + 1, dtype=torch.float32
      )
  
      # Parameter for the add_histogram_raw function of SummaryWriter
      hist_params = dict(
          tag=hist_name,
          min=ht_min,
          max=ht_max,
          num=len(hist_tensor),
          sum=float(hist_tensor.sum()),
          sum_squares=float(torch.sum(hist_tensor**2)),
          bucket_limits=hist_edges[1:].tolist(),
          bucket_counts=hist_counts.tolist(),
          global_step=self._iter,
      )
      self._histograms.append(hist_params)
  
imports: import datetime
  import json
  import logging
  import os
  import time
  from collections import defaultdict
  from contextlib import contextmanager
  from functools import cached_property
  from typing import Optional
  import torch
  from fvcore.common.history_buffer import HistoryBuffer
  from detectron2.utils.file_io import PathManager
label_desc: Use image node_id 5 for calling the EventStorage obj's underlying member method code with example usage: obj.put_histogram(hist_name, hist_tensor, bins) without return types