class_docstr: A down-sample module used in RegUNet to half the spatial size.
  The number of channels is kept same.
  
  Adapted from:
      DeepReg (https://github.com/DeepRegNet/DeepReg)
class_docstr_tok: ["A","down-sample","module","used","in","RegUNet","to","half","the","spatial","size",".","The","number","of","channels","is","kept","same",".","Adapted","from",":","DeepReg","(","https",":","\/\/github.com\/DeepRegNet\/DeepReg",")"]
docstr: Halves the spatial dimensions and keeps the same channel.
  output in shape (batch, ``channels``, insize_1 / 2, insize_2 / 2, [insize_3 / 2]),
  
  Args:
      x: Tensor in shape (batch, ``channels``, insize_1, insize_2, [insize_3])
  
  Raises:
      ValueError: when input spatial dimensions are not even.
docstr_tok: ["Halves","the","spatial","dimensions","and","keeps","the","same","channel",".","output","in","shape","(","batch",",","``","channels","``",",","insize_1","\/","2",",","insize_2","\/","2",",","[","insize_3","\/","2","]",")",",","Args",":","x",":","Tensor","in","shape","(","batch",",","``","channels","``",",","insize_1",",","insize_2",",","[","insize_3","]",")","Raises",":","ValueError",":","when","input","spatial","dimensions","are","not","even","."]
code: def forward(self, x: torch.Tensor) -> torch.Tensor:
      """
      Halves the spatial dimensions and keeps the same channel.
      output in shape (batch, ``channels``, insize_1 / 2, insize_2 / 2, [insize_3 / 2]),
  
      Args:
          x: Tensor in shape (batch, ``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}"
              )
      out: torch.Tensor = self.layer(x)
      return out
  
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 Conv, Norm, Pool, same_padding
label_desc: Use image node_id 2 for calling the RegistrationDownSampleBlock obj's underlying member method code with example usage: obj.forward(x) and returns: out