class_docstr: ## U-Net
class_docstr_tok: ["#","#","U-Net"]
docstr: :param x: input image
docstr_tok: [":","param","x",":","input","image"]
code: def forward(self, x: torch.Tensor):
      """
      :param x: input image
      """
      # To collect the outputs of contracting path for later concatenation with the expansive path.
      pass_through = []
      # Contracting path
      for i in range(len(self.down_conv)):
          # Two $3 \times 3$ convolutional layers
          x = self.down_conv[i](x)
          # Collect the output
          pass_through.append(x)
          # Down-sample
          x = self.down_sample[i](x)
  
      # Two $3 \times 3$ convolutional layers at the bottom of the U-Net
      x = self.middle_conv(x)
  
      # Expansive path
      for i in range(len(self.up_conv)):
          # Up-sample
          x = self.up_sample[i](x)
          # Concatenate the output of the contracting path
          x = self.concat[i](x, pass_through.pop())
          # Two $3 \times 3$ convolutional layers
          x = self.up_conv[i](x)
  
      # Final $1 \times 1$ convolution layer
      x = self.final_conv(x)
  
      #
      return x
  
imports: import torch
  import torchvision.transforms.functional
  from torch import nn
label_desc: Use image node_id 2 for calling the UNet obj's underlying member method code with example usage: obj.forward(x) and returns: x