code: def marginal_pdf(
      values: torch.Tensor,
      bins: torch.Tensor,
      sigma: torch.Tensor,
      epsilon: float = 1e-10,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """Calculate the marginal probability distribution function of the input tensor based on the number of
      histogram bins.
  
      Args:
          values: shape [BxNx1].
          bins: shape [NUM_BINS].
          sigma: shape [1], gaussian smoothing factor.
          epsilon: scalar, for numerical stability.
  
      Returns:
          Tuple[torch.Tensor, torch.Tensor]:
            - torch.Tensor: shape [BxN].
            - torch.Tensor: shape [BxNxNUM_BINS].
      """
  
      if not isinstance(values, torch.Tensor):
          raise TypeError(
              f"Input values type is not a torch.Tensor. Got {type(values)}"
          )
  
      if not isinstance(bins, torch.Tensor):
          raise TypeError(
              f"Input bins type is not a torch.Tensor. Got {type(bins)}"
          )
  
      if not isinstance(sigma, torch.Tensor):
          raise TypeError(
              f"Input sigma type is not a torch.Tensor. Got {type(sigma)}"
          )
  
      if not values.dim() == 3:
          raise ValueError(
              f"Input values must be a of the shape BxNx1. Got {values.shape}"
          )
  
      if not bins.dim() == 1:
          raise ValueError(
              f"Input bins must be a of the shape NUM_BINS. Got {bins.shape}"
          )
  
      if not sigma.dim() == 0:
          raise ValueError(
              f"Input sigma must be a of the shape 1. Got {sigma.shape}"
          )
  
      residuals = values - bins.unsqueeze(0).unsqueeze(0)
      kernel_values = torch.exp(-0.5 * (residuals / sigma).pow(2))
  
      pdf = torch.mean(kernel_values, dim=1)
      normalization = torch.sum(pdf, dim=1).unsqueeze(1) + epsilon
      pdf = pdf / normalization
  
      return pdf, kernel_values
  
imports: from typing import Optional, Tuple
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: marginal_pdf(values, bins, sigma, epsilon) and returns: pdf,  kernel_values