class_docstr: Implementation of a trainable joint bilateral filter layer as proposed in the corresponding publication.
  The guidance image is used as additional (edge) information during filtering. All filter parameters and the
  guidance image can be trained data-driven. The spatial filter kernels x, y, and z determine
  image smoothing whereas the color parameter specifies the amount of edge preservation.
  Can run on 1D, 2D, or 3D tensors (on top of Batch and Channel dimensions). Input tensor shape must match
  guidance tensor shape.
  
  See:
      F. Wagner, et al., Trainable joint bilateral filters for enhanced prediction stability in
      low-dose CT, Scientific Reports (2022), https://doi.org/10.1038/s41598-022-22530-4
  
  Args:
      input: input tensor to be filtered.
      guide: guidance image tensor to be used during filtering.
      spatial_sigma: tuple (sigma_x, sigma_y, sigma_z) initializing the trainable standard
          deviations of the spatial filter kernels. Tuple length must equal the number of
          spatial input dimensions.
      color_sigma: trainable standard deviation of the intensity range kernel. This filter
          parameter determines the degree of edge preservation.
  
  Returns:
      output (torch.Tensor): filtered tensor.
class_docstr_tok: ["Implementation","of","a","trainable","joint","bilateral","filter","layer","as","proposed","in","the","corresponding","publication",".","The","guidance","image","is","used","as","additional","(","edge",")","information","during","filtering",".","All","filter","parameters","and","the","guidance","image","can","be","trained","data-driven",".","The","spatial","filter","kernels","x",",","y",",","and","z","determine","image","smoothing","whereas","the","color","parameter","specifies","the","amount","of","edge","preservation",".","Can","run","on","1D",",","2D",",","or","3D","tensors","(","on","top","of","Batch","and","Channel","dimensions",")",".","Input","tensor","shape","must","match","guidance","tensor","shape",".","See",":","F.","Wagner",",","et","al.",",","Trainable","joint","bilateral","filters","for","enhanced","prediction","stability","in","low-dose","CT",",","Scientific","Reports","(","2022",")",",","https",":","\/\/doi.org\/10.1038\/s41598-022-22530-4","Args",":","input",":","input","tensor","to","be","filtered",".","guide",":","guidance","image","tensor","to","be","used","during","filtering",".","spatial_sigma",":","tuple","(","sigma_x",",","sigma_y",",","sigma_z",")","initializing","the","trainable","standard","deviations","of","the","spatial","filter","kernels",".","Tuple","length","must","equal","the","number","of","spatial","input","dimensions",".","color_sigma",":","trainable","standard","deviation","of","the","intensity","range","kernel",".","This","filter","parameter","determines","the","degree","of","edge","preservation",".","Returns",":","output","(","torch.Tensor",")",":","filtered","tensor","."]
code: def forward(self, input_tensor, guidance_tensor):
      if input_tensor.shape[1] != 1:
          raise ValueError(
              f"Currently channel dimensions >1 ({input_tensor.shape[1]}) are not supported. "
              "Please use multiple parallel filter layers if you want "
              "to filter multiple channels."
          )
      if input_tensor.shape != guidance_tensor.shape:
          raise ValueError(
              "Shape of input image must equal shape of guidance image."
              f"Got {input_tensor.shape} and {guidance_tensor.shape}."
          )
  
      len_input = len(input_tensor.shape)
  
      # C++ extension so far only supports 5-dim inputs.
      if len_input == 3:
          input_tensor = input_tensor.unsqueeze(3).unsqueeze(4)
          guidance_tensor = guidance_tensor.unsqueeze(3).unsqueeze(4)
      elif len_input == 4:
          input_tensor = input_tensor.unsqueeze(4)
          guidance_tensor = guidance_tensor.unsqueeze(4)
  
      if self.len_spatial_sigma != len_input:
          raise ValueError(
              f"Spatial dimension ({len_input}) must match initialized len(spatial_sigma)."
          )
  
      prediction = TrainableJointBilateralFilterFunction.apply(
          input_tensor,
          guidance_tensor,
          self.sigma_x,
          self.sigma_y,
          self.sigma_z,
          self.sigma_color,
      )
  
      # Make sure to return tensor of the same shape as the input.
      if len_input == 3:
          prediction = prediction.squeeze(4).squeeze(3)
      elif len_input == 4:
          prediction = prediction.squeeze(4)
  
      return prediction
  
imports: from __future__ import annotations
  import torch
  from monai.utils.module import optional_import
label_desc: Use image node_id 2 for calling the TrainableJointBilateralFilter obj's underlying member method code with example usage: obj.forward(input_tensor, guidance_tensor) and returns: prediction