class_docstr: Segmentation head.
  This class refers to `segmentation_models.pytorch
  <https://github.com/qubvel/segmentation_models.pytorch>`_.
  
  Args:
      spatial_dims: number of spatial dimensions.
      in_channels: number of input channels for the block.
      out_channels: number of output channels for the block.
      kernel_size: kernel size for the conv layer.
      act: activation type and arguments.
      scale_factor: multiplier for spatial size. Has to match input size if it is a tuple.
class_docstr_tok: ["Segmentation","head",".","This","class","refers","to","`","segmentation_models.pytorch","<","https",":","\/\/github.com\/qubvel\/segmentation_models.pytorch",">","`","_",".","Args",":","spatial_dims",":","number","of","spatial","dimensions",".","in_channels",":","number","of","input","channels","for","the","block",".","out_channels",":","number","of","output","channels","for","the","block",".","kernel_size",":","kernel","size","for","the","conv","layer",".","act",":","activation","type","and","arguments",".","scale_factor",":","multiplier","for","spatial","size",".","Has","to","match","input","size","if","it","is","a","tuple","."]
code: def __init__(
      self,
      spatial_dims: int,
      in_channels: int,
      out_channels: int,
      kernel_size: int = 3,
      act: tuple | str | None = None,
      scale_factor: float = 1.0,
  ):
      conv_layer = Conv[Conv.CONV, spatial_dims](
          in_channels=in_channels,
          out_channels=out_channels,
          kernel_size=kernel_size,
          padding=kernel_size // 2,
      )
      up_layer: nn.Module = nn.Identity()
      if scale_factor > 1.0:
          up_layer = UpSample(
              spatial_dims=spatial_dims,
              scale_factor=scale_factor,
              mode="nontrainable",
              pre_conv=None,
              interp_mode=InterpolateMode.LINEAR,
          )
      if act is not None:
          act_layer = get_act_layer(act)
      else:
          act_layer = nn.Identity()
      super().__init__(conv_layer, up_layer, act_layer)
  
imports: from __future__ import annotations
  import warnings
  from collections.abc import Sequence
  from pydoc import locate
  from typing import Any
  import torch
  from torch import nn
  from monai.networks.blocks import BaseEncoder, UpSample
  from monai.networks.layers.factories import Conv
  from monai.networks.layers.utils import get_act_layer
  from monai.networks.nets import EfficientNetEncoder
  from monai.networks.nets.basic_unet import UpCat
  from monai.utils import InterpolateMode, optional_import
label_desc: Use image node_id 1 to create a new SegmentationHead object from inherited base classes: nn with example: obj = SegmentationHead(spatial_dims, in_channels, out_channels, kernel_size, act, scale_factor)