class_docstr: Calculate the diffusion based on first-order differentiation of ``pred`` using central finite difference.
  For the original paper, please refer to
  VoxelMorph: A Learning Framework for Deformable Medical Image Registration,
  Guha Balakrishnan, Amy Zhao, Mert R. Sabuncu, John Guttag, Adrian V. Dalca
  IEEE TMI: Transactions on Medical Imaging. 2019. eprint arXiv:1809.05231.
  
  For more information,
  see https://github.com/Project-MONAI/tutorials/blob/main/modules/bending_energy_diffusion_loss_notes.ipynb.
  
  Adapted from:
      VoxelMorph (https://github.com/voxelmorph/voxelmorph)
class_docstr_tok: ["Calculate","the","diffusion","based","on","first-order","differentiation","of","``","pred","``","using","central","finite","difference",".","For","the","original","paper",",","please","refer","to","VoxelMorph",":","A","Learning","Framework","for","Deformable","Medical","Image","Registration",",","Guha","Balakrishnan",",","Amy","Zhao",",","Mert","R.","Sabuncu",",","John","Guttag",",","Adrian","V.","Dalca","IEEE","TMI",":","Transactions","on","Medical","Imaging",".","2019.","eprint","arXiv:1809.05231",".","For","more","information",",","see","https",":","\/\/github.com\/Project-MONAI\/tutorials\/blob\/main\/modules\/bending_energy_diffusion_loss_notes.ipynb",".","Adapted","from",":","VoxelMorph","(","https",":","\/\/github.com\/voxelmorph\/voxelmorph",")"]
docstr: Args:
      normalize:
          Whether to divide out spatial sizes in order to make the computation roughly
          invariant to image scale (i.e. vector field sampling resolution). Defaults to False.
      reduction: {``"none"``, ``"mean"``, ``"sum"``}
          Specifies the reduction to apply to the output. Defaults to ``"mean"``.
  
          - ``"none"``: no reduction will be applied.
          - ``"mean"``: the sum of the output will be divided by the number of elements in the output.
          - ``"sum"``: the output will be summed.
docstr_tok: ["Args",":","normalize",":","Whether","to","divide","out","spatial","sizes","in","order","to","make","the","computation","roughly","invariant","to","image","scale","(","i.e",".","vector","field","sampling","resolution",")",".","Defaults","to","False",".","reduction",":","{","``","``","none","''","``",",","``","``","mean","''","``",",","``","``","sum","''","``","}","Specifies","the","reduction","to","apply","to","the","output",".","Defaults","to","``","``","mean","''","``",".","-","``","``","none","''","``",":","no","reduction","will","be","applied",".","-","``","``","mean","''","``",":","the","sum","of","the","output","will","be","divided","by","the","number","of","elements","in","the","output",".","-","``","``","sum","''","``",":","the","output","will","be","summed","."]
code: def __init__(
      self,
      normalize: bool = False,
      reduction: LossReduction | str = LossReduction.MEAN,
  ) -> None:
      """
      Args:
          normalize:
              Whether to divide out spatial sizes in order to make the computation roughly
              invariant to image scale (i.e. vector field sampling resolution). Defaults to False.
          reduction: {``"none"``, ``"mean"``, ``"sum"``}
              Specifies the reduction to apply to the output. Defaults to ``"mean"``.
  
              - ``"none"``: no reduction will be applied.
              - ``"mean"``: the sum of the output will be divided by the number of elements in the output.
              - ``"sum"``: the output will be summed.
      """
      super().__init__(reduction=LossReduction(reduction).value)
      self.normalize = normalize
  
file_path: MONAI/monai/losses/deform.py
imports: from __future__ import annotations
  import torch
  from torch.nn.modules.loss import _Loss
  from monai.utils import LossReduction
label_desc: Use image node_id 1 to create a new DiffusionLoss object from inherited base classes: _Loss with example: obj = DiffusionLoss(normalize, reduction)