class_docstr: A down-sample module that can be used for LocalNet, based on:
  `Weakly-supervised convolutional neural networks for multimodal image registration
  <https://doi.org/10.1016/j.media.2018.07.002>`_.
  `Label-driven weakly-supervised learning for multimodal deformable image registration
  <https://arxiv.org/abs/1711.01666>`_.
  
  Adapted from:
      DeepReg (https://github.com/DeepRegNet/DeepReg)
docstr: Halves the spatial dimensions.
  A tuple of (x, mid) is returned:
  
      -  x is the downsample result, in shape (batch, ``out_channels``, insize_1 / 2, insize_2 / 2, [insize_3 / 2]),
      -  mid is the mid-level feature, in shape (batch, ``out_channels``, insize_1, insize_2, [insize_3])
  
  Args:
      x: Tensor in shape (batch, ``in_channels``, insize_1, insize_2, [insize_3])
  
  Raises:
      ValueError: when input spatial dimensions are not even.
docstr_tok: ["Halves","the","spatial","dimensions",".","A","tuple","of","(","x",",","mid",")","is","returned",":","-","x","is","the","downsample","result",",","in","shape","(","batch",",","``","out_channels","``",",","insize_1","\/","2",",","insize_2","\/","2",",","[","insize_3","\/","2","]",")",",","-","mid","is","the","mid-level","feature",",","in","shape","(","batch",",","``","out_channels","``",",","insize_1",",","insize_2",",","[","insize_3","]",")","Args",":","x",":","Tensor","in","shape","(","batch",",","``","in_channels","``",",","insize_1",",","insize_2",",","[","insize_3","]",")","Raises",":","ValueError",":","when","input","spatial","dimensions","are","not","even","."]
code: def forward(self, x) -> tuple[torch.Tensor, torch.Tensor]:
      """
      Halves the spatial dimensions.
      A tuple of (x, mid) is returned:
  
          -  x is the downsample result, in shape (batch, ``out_channels``, insize_1 / 2, insize_2 / 2, [insize_3 / 2]),
          -  mid is the mid-level feature, in shape (batch, ``out_channels``, insize_1, insize_2, [insize_3])
  
      Args:
          x: Tensor in shape (batch, ``in_channels``, insize_1, insize_2, [insize_3])
  
      Raises:
          ValueError: when input spatial dimensions are not even.
      """
      for i in x.shape[2:]:
          if i % 2 != 0:
              raise ValueError(
                  "expecting x spatial dimensions be even, "
                  f"got x of shape {x.shape}"
              )
      x = self.conv_block(x)
      mid = self.residual_block(x)
      x = self.max_pool(mid)
      return x, mid
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  import torch
  from torch import nn
  from torch.nn import functional
  from monai.networks.blocks import Convolution
  from monai.networks.layers import same_padding
  from monai.networks.layers.factories import Conv, Norm, Pool
label_desc: Use image node_id 2 for calling the LocalNetDownSampleBlock obj's underlying member method code with example usage: obj.forward(x) and returns: x,  mid