code: def integer_histogram(
      data: torch.LongTensor,
      min: Union[None, int] = None,
      max: Union[None, int] = None,
  ) -> torch.Tensor:
      """
      Create histogram of integers in predefined range
  
      Args:
          data: data for which to create histogram
          min: minimum of histogram, is inferred from data by default
          max: maximum of histogram, is inferred from data by default
  
      Returns:
          histogram
      """
      uniques, counts = torch.unique(data, return_counts=True)
      if min is None:
          min = uniques.min()
      if max is None:
          max = uniques.max()
      hist = torch.zeros(
          max - min + 1, dtype=torch.long, device=data.device
      ).scatter(dim=0, index=uniques - min, src=counts)
      return hist
  
imports: from collections import namedtuple
  from contextlib import redirect_stdout
  import inspect
  import os
  from typing import Any, Callable, Dict, List, Tuple, Union
  import lightning.pytorch
  import torch
  from torch import nn
  from torch.fft import irfft, rfft
  import torch.nn.functional
  from torch.nn.utils import rnn
label_desc: Use image node_id 1 for calling a global function with example usage: integer_histogram(data, min, max) and returns: hist