code: def d4_image2mask(model: nn.Module, image: Tensor) -> Tensor:
      """Test-time augmentation for image segmentation that averages predictions
      of all D4 augmentations applied to input image.
  
      For segmentation we need to reverse the augmentation after making a prediction
      on augmented input.
      :param model: Model to use for making predictions.
      :param image: Model input.
      :return: Arithmetically averaged predictions
      """
      return d4_image_deaugment(model(d4_image_augment(image)))
  
imports: from collections import defaultdict
  from functools import partial
  from typing import Tuple, List, Optional, Union, Callable, Dict, Mapping
  import torch
  from torch import Tensor, nn
  from .None import functional
  from ..utils.support import pytorch_toolbelt_deprecated
label_desc: Use image node_id 10 for calling a global function with example usage: d4_image2mask(model, image) and returns: d4_image_deaugment