# Buggy code
def __init__(
    self,
    keys: KeysCollection,
    pixdim: Sequence[float],
    diagonal: bool = False,
    mode: GridSampleModeSequence = GridSampleMode.BILINEAR,
    padding_mode: GridSamplePadModeSequence = GridSamplePadMode.BORDER,
    dtype: Optional[Union[Sequence[np.dtype], np.dtype]] = None,
    meta_key_postfix: str = "meta_dict",
) -> None:
    """
    Args:
        pixdim: output voxel spacing.
        diagonal: whether to resample the input to have a diagonal affine matrix.
            If True, the input data is resampled to the following affine::

                np.diag((pixdim_0, pixdim_1, pixdim_2, 1))

            This effectively resets the volume to the world coordinate system (RAS+ in nibabel).
            The original orientation, rotation, shearing are not preserved.

            If False, the axes orientation, orthogonal rotation and
            translations components from the original affine will be
            preserved in the target affine. This option will not flip/swap
            axes against the original ones.
        mode: {``"bilinear"``, ``"nearest"``}
            Interpolation mode to calculate output values. Defaults to ``"bilinear"``.
            See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
            It also can be a sequence of string, each element corresponds to a key in ``keys``.
        padding_mode: {``"zeros"``, ``"border"``, ``"reflection"``}
            Padding mode for outside grid values. Defaults to ``"border"``.
            See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
            It also can be a sequence of string, each element corresponds to a key in ``keys``.
        dtype: output array data type.
            Defaults to None to use input data's dtype. It also can be a sequence of np.dtype,
            each element corresponds to a key in ``keys``.
        meta_key_postfix: use `key_{postfix}` to to fetch the meta data according to the key data,
            default is `meta_dict`, the meta data is a dictionary object.
            For example, to handle key `image`,  read/write affine matrices from the
            metadata `image_meta_dict` dictionary's `affine` field.

    Raises:
        TypeError: When ``meta_key_postfix`` is not a ``str``.

    """
    super().__init__(keys)
    self.spacing_transform = Spacing(pixdim, diagonal=diagonal)
    self.mode = ensure_tuple_rep(mode, len(self.keys))
    self.padding_mode = ensure_tuple_rep(padding_mode, len(self.keys))
    self.dtype = ensure_tuple_rep(dtype, len(self.keys))
    if not isinstance(meta_key_postfix, str):
        raise TypeError(
            f"meta_key_postfix must be a str but is {type(meta_key_postfix).__name__}."
        )
    self.meta_key_postfix = meta_key_postfix


# Traceback (AssertionError)
======================================================================
FAIL: test_training (__main__.IntegrationSegmentation3D)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests/test_integration_segmentation_3d.py", line 257, in test_training
rtol=1e-3,
File "/opt/conda/lib/python3.6/site-packages/numpy/testing/_private/utils.py", line 1533, in assert_allclose
verbose=verbose, header=header, equal_nan=equal_nan)
File "/opt/conda/lib/python3.6/site-packages/numpy/testing/_private/utils.py", line 846, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Not equal to tolerance rtol=0.001, atol=0

Mismatched elements: 6 / 6 (100%)
Max absolute difference: 0.01720129
Max relative difference: 0.04047175
x: array([0.543151, 0.471052, 0.453605, 0.438546, 0.437794, 0.407818])
y: array([0.544673, 0.475109, 0.444963, 0.427036, 0.433381, 0.42502 ])

----------------------------------------------------------------------
Ran 1 test in 92.377s

FAILED (failures=1)

# Fixed code
def __init__(
    self,
    keys: KeysCollection,
    pixdim: Sequence[float],
    diagonal: bool = False,
    mode: GridSampleModeSequence = GridSampleMode.BILINEAR,
    padding_mode: GridSamplePadModeSequence = GridSamplePadMode.BORDER,
    align_corners: Union[Sequence[bool], bool] = False,
    dtype: Optional[Union[Sequence[np.dtype], np.dtype]] = np.float64,
    meta_key_postfix: str = "meta_dict",
) -> None:
    """
    Args:
        pixdim: output voxel spacing.
        diagonal: whether to resample the input to have a diagonal affine matrix.
            If True, the input data is resampled to the following affine::

                np.diag((pixdim_0, pixdim_1, pixdim_2, 1))

            This effectively resets the volume to the world coordinate system (RAS+ in nibabel).
            The original orientation, rotation, shearing are not preserved.

            If False, the axes orientation, orthogonal rotation and
            translations components from the original affine will be
            preserved in the target affine. This option will not flip/swap
            axes against the original ones.
        mode: {``"bilinear"``, ``"nearest"``}
            Interpolation mode to calculate output values. Defaults to ``"bilinear"``.
            See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
            It also can be a sequence of string, each element corresponds to a key in ``keys``.
        padding_mode: {``"zeros"``, ``"border"``, ``"reflection"``}
            Padding mode for outside grid values. Defaults to ``"border"``.
            See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
            It also can be a sequence of string, each element corresponds to a key in ``keys``.
        align_corners: Geometrically, we consider the pixels of the input as squares rather than points.
            See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
            It also can be a sequence of bool, each element corresponds to a key in ``keys``.
        dtype: data type for resampling computation. Defaults to ``np.float64`` for best precision.
            If None, use the data type of input data. To be compatible with other modules,
            the output data type is always ``np.float32``.
            It also can be a sequence of np.dtype, each element corresponds to a key in ``keys``.
        meta_key_postfix: use `key_{postfix}` to to fetch the meta data according to the key data,
            default is `meta_dict`, the meta data is a dictionary object.
            For example, to handle key `image`,  read/write affine matrices from the
            metadata `image_meta_dict` dictionary's `affine` field.

    Raises:
        TypeError: When ``meta_key_postfix`` is not a ``str``.

    """
    super().__init__(keys)
    self.spacing_transform = Spacing(pixdim, diagonal=diagonal)
    self.mode = ensure_tuple_rep(mode, len(self.keys))
    self.padding_mode = ensure_tuple_rep(padding_mode, len(self.keys))
    self.align_corners = ensure_tuple_rep(align_corners, len(self.keys))
    self.dtype = ensure_tuple_rep(dtype, len(self.keys))
    if not isinstance(meta_key_postfix, str):
        raise TypeError(
            f"meta_key_postfix must be a str but is {type(meta_key_postfix).__name__}."
        )
    self.meta_key_postfix = meta_key_postfix