code: def per_sample_transform(self, sample: Any) -> Any:
      resize = T.Resize(
          sample[DataKeys.METADATA]["size"],
          interpolation=InterpolationMode.NEAREST,
      )
      sample[DataKeys.PREDS]["masks"] = [
          resize(tensor(mask))
          for mask in sample[DataKeys.PREDS]["masks"]
      ]
      return sample[DataKeys.PREDS]
  
imports: from functools import partial
  from typing import Any, Callable, Dict, List, Optional, Type, Union
  from torch import tensor
  from flash.core.data.data_module import DataModule
  from flash.core.data.io.input import DataKeys, Input
  from flash.core.data.io.output_transform import OutputTransform
  from flash.core.data.utilities.sort import sorted_alphanumeric
  from flash.core.integrations.icevision.data import IceVisionInput
  from flash.core.integrations.icevision.transforms import IceVisionInputTransform
  from flash.core.utilities.imports import _ICEVISION_AVAILABLE, _TOPIC_IMAGE_AVAILABLE, _TORCHVISION_AVAILABLE, _TORCHVISION_GREATER_EQUAL_0_9
  from flash.core.utilities.stages import RunningStage
  from flash.core.utilities.types import INPUT_TRANSFORM_TYPE
label_desc: Use image node_id 1 for calling the InstanceSegmentationOutputTransform obj's underlying member method code with example usage: obj.per_sample_transform(sample) and returns: sample