class_docstr: upsampling, concatenation with the encoder feature map, two convolutions
class_docstr_tok: ["upsampling",",","concatenation","with","the","encoder","feature","map",",","two","convolutions"]
docstr: Args:
      x: features to be upsampled.
      x_e: optional features from the encoder, if None, this branch is not in use.
docstr_tok: ["Args",":","x",":","features","to","be","upsampled",".","x_e",":","optional","features","from","the","encoder",",","if","None",",","this","branch","is","not","in","use","."]
code: def forward(self, x: torch.Tensor, x_e: Optional[torch.Tensor]):
      """
  
      Args:
          x: features to be upsampled.
          x_e: optional features from the encoder, if None, this branch is not in use.
      """
      x_0 = self.upsample(x)
  
      if x_e is not None and torch.jit.isinstance(x_e, torch.Tensor):
          if self.is_pad:
              # handling spatial shapes due to the 2x maxpooling with odd edge lengths.
              dimensions = len(x.shape) - 2
              sp = [0] * (dimensions * 2)
              for i in range(dimensions):
                  if x_e.shape[-i - 1] != x_0.shape[-i - 1]:
                      sp[i * 2 + 1] = 1
              x_0 = torch.nn.functional.pad(x_0, sp, "replicate")
          x = self.convs(
              torch.cat([x_e, x_0], dim=1)
          )  # input channels: (cat_chns + up_chns)
      else:
          x = self.convs(x_0)
  
      return x
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  from typing import Optional
  import torch
  import torch.nn
  from monai.networks.blocks import Convolution, UpSample
  from monai.networks.layers.factories import Conv, Pool
  from monai.utils import ensure_tuple_rep
label_desc: Use image node_id 2 for calling the UpCat obj's underlying member method code with example usage: obj.forward(x, x_e) and returns: x