class_docstr: HoVerNet model
  
  References:
    Graham, Simon et al. Hover-net: Simultaneous segmentation
    and classification of nuclei in multi-tissue histology images,
    Medical Image Analysis 2019
  
    https://github.com/vqdang/hover_net
    https://pytorch.org/vision/main/models/generated/torchvision.models.resnet50.html
  
  This network is non-deterministic since it uses `torch.nn.Upsample` with ``UpsampleMode.NONTRAINABLE`` mode which
  is implemented with torch.nn.functional.interpolate(). Please check the link below for more details:
  https://pytorch.org/docs/stable/generated/torch.use_deterministic_algorithms.html#torch.use_deterministic_algorithms
  
  Args:
      mode: use original implementation (`HoVerNetMODE.ORIGINAL` or "original") or
        a faster implementation (`HoVerNetMODE.FAST` or "fast"). Defaults to `HoVerNetMODE.FAST`.
      in_channels: number of the input channel.
      np_out_channels: number of the output channel of the nucleus prediction branch.
      out_classes: number of the nuclear type classes.
      act: activation type and arguments. Defaults to relu.
      norm: feature normalization type and arguments. Defaults to batch norm.
      decoder_padding: whether to do padding on convolution layers in the decoders. In the conic branch
          of the referred repository, the architecture is changed to do padding on convolution layers in order to
          get the same output size as the input, and this changed version is used on CoNIC challenge.
          Please note that to get consistent output size, `HoVerNetMode.FAST` mode should be employed.
      dropout_prob: dropout rate after each dense layer.
      pretrained_url: if specifying, will loaded the pretrained weights downloaded from the url.
          There are two supported forms of weights:
          1. preact-resnet50 weights coming from the referred hover_net
          repository, each user is responsible for checking the content of model/datasets and the applicable licenses
          and determining if suitable for the intended use. please check the following link for more details:
          https://github.com/vqdang/hover_net#data-format
          2. standard resnet50 weights of torchvision. Please check the following link for more details:
          https://pytorch.org/vision/main/_modules/torchvision/models/resnet.html#ResNet50_Weights
      adapt_standard_resnet: if the pretrained weights of the encoder follow the original format (preact-resnet50), this
          value should be `False`. If using the pretrained weights that follow torchvision's standard resnet50 format,
          this value should be `True`.
      pretrained_state_dict_key: this arg is used when `pretrained_url` is provided and `adapt_standard_resnet` is True.
          It is used to extract the expected state dict.
      freeze_encoder: whether to freeze the encoder of the network.
code: def forward(self, x: torch.Tensor) -> dict[str, torch.Tensor]:
      if self.mode == HoVerNetMode.ORIGINAL.value:
          if x.shape[-1] != 270 or x.shape[-2] != 270:
              raise ValueError(
                  "Input size should be 270 x 270 when using HoVerNetMode.ORIGINAL"
              )
      else:
          if x.shape[-1] != 256 or x.shape[-2] != 256:
              raise ValueError(
                  "Input size should be 256 x 256 when using HoVerNetMode.FAST"
              )
  
      x = self.conv0(x)
      short_cuts = []
  
      for i, block in enumerate(self.res_blocks):
          x = block.forward(x)
  
          if i <= 2:
              short_cuts.append(x)
  
      x = self.bottleneck(x)
      x = self.upsample(x)
  
      output = {
          HoVerNetBranch.NP.value: self.nucleus_prediction(
              x, short_cuts
          ),
          HoVerNetBranch.HV.value: self.horizontal_vertical(
              x, short_cuts
          ),
      }
      if self.type_prediction is not None:
          output[HoVerNetBranch.NC.value] = self.type_prediction(
              x, short_cuts
          )
  
      return output
  
imports: from __future__ import annotations
  import os
  import re
  import warnings
  from collections import OrderedDict
  from collections.abc import Callable, Sequence
  import torch
  import torch.nn
  from monai.apps.utils import download_url
  from monai.networks.blocks import UpSample
  from monai.networks.layers.factories import Conv, Dropout
  from monai.networks.layers.utils import get_act_layer, get_norm_layer
  from monai.utils.enums import HoVerNetBranch, HoVerNetMode, InterpolateMode, UpsampleMode
  from monai.utils.module import export, look_up_option
label_desc: Use image node_id 2 for calling the HoVerNet obj's underlying member method code with example usage: obj.forward(x) and returns: output