class_docstr: torch.autograd.Function for the TrainableBilateralFilter layer.
  
  See:
      F. Wagner, et al., Ultralow-parameter denoising: Trainable bilateral filter layers in
      computed tomography, Medical Physics (2022), https://doi.org/10.1002/mp.15718
  
  Args:
      input: input tensor to be filtered.
      sigma x: trainable standard deviation of the spatial filter kernel in x direction.
      sigma y: trainable standard deviation of the spatial filter kernel in y direction.
      sigma z: trainable standard deviation of the spatial filter kernel in z direction.
      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: ["torch.autograd.Function","for","the","TrainableBilateralFilter","layer",".","See",":","F.","Wagner",",","et","al.",",","Ultralow-parameter","denoising",":","Trainable","bilateral","filter","layers","in","computed","tomography",",","Medical","Physics","(","2022",")",",","https",":","\/\/doi.org\/10.1002\/mp.15718","Args",":","input",":","input","tensor","to","be","filtered",".","sigma","x",":","trainable","standard","deviation","of","the","spatial","filter","kernel","in","x","direction",".","sigma","y",":","trainable","standard","deviation","of","the","spatial","filter","kernel","in","y","direction",".","sigma","z",":","trainable","standard","deviation","of","the","spatial","filter","kernel","in","z","direction",".","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 backward(ctx, grad_output):
      input_img = ctx.saved_tensors[0]  # input image
      sigma_x = ctx.saved_tensors[1]
      sigma_y = ctx.saved_tensors[2]
      sigma_z = ctx.saved_tensors[3]
      color_sigma = ctx.saved_tensors[4]
      output_tensor = ctx.saved_tensors[5]  # filtered image
      output_weights_tensor = ctx.saved_tensors[6]  # weights
      do_dx_ki = ctx.saved_tensors[
          7
      ]  # derivative of output with respect to input, while k==i
      do_dsig_r = ctx.saved_tensors[
          8
      ]  # derivative of output with respect to range sigma
      do_dsig_x = ctx.saved_tensors[
          9
      ]  # derivative of output with respect to sigma x
      do_dsig_y = ctx.saved_tensors[
          10
      ]  # derivative of output with respect to sigma y
      do_dsig_z = ctx.saved_tensors[
          11
      ]  # derivative of output with respect to sigma z
  
      # calculate gradient with respect to the sigmas
      grad_color_sigma = torch.sum(grad_output * do_dsig_r)
      grad_sig_x = torch.sum(grad_output * do_dsig_x)
      grad_sig_y = torch.sum(grad_output * do_dsig_y)
      grad_sig_z = torch.sum(grad_output * do_dsig_z)
  
      grad_output_tensor = _C.tbf_backward(
          grad_output,
          input_img,
          output_tensor,
          output_weights_tensor,
          do_dx_ki,
          sigma_x,
          sigma_y,
          sigma_z,
          color_sigma,
      )
  
      return (
          grad_output_tensor,
          grad_sig_x,
          grad_sig_y,
          grad_sig_z,
          grad_color_sigma,
      )
  
imports: from __future__ import annotations
  import torch
  from monai.utils.module import optional_import
label_desc: Use image node_id 2 for calling the TrainableBilateralFilterFunction obj's underlying member method code with example usage: obj.backward(ctx, grad_output) and returns: grad_output_tensor,  grad_sig_x,  grad_sig_y,  grad_sig_z,  grad_color_sigma