code: def __init__(
      self,
      depth,
      encoder_blocks_channels,
      norm_layer,
      attention_layer=None,
      attend_from=3,
      image_fusion=False,
  ):
      super(UNetDecoder, self).__init__()
      self.up_blocks = nn.ModuleList()
      self.image_fusion = image_fusion
      in_channels = encoder_blocks_channels.pop()
      out_channels = in_channels
      # Last encoder layer doesn't pool, so there're only (depth - 1) deconvs
      for d in range(depth - 1):
          out_channels = (
              encoder_blocks_channels.pop()
              if len(encoder_blocks_channels)
              else in_channels // 2
          )
          stage_attention_layer = (
              attention_layer if 0 <= attend_from <= d else None
          )
          self.up_blocks.append(
              UNetUpBlock(
                  in_channels,
                  out_channels,
                  out_channels,
                  norm_layer=norm_layer,
                  activation=partial(nn.ReLU, inplace=True),
                  padding=1,
                  attention_layer=stage_attention_layer,
              )
          )
          in_channels = out_channels
  
      if self.image_fusion:
          self.conv_attention = nn.Conv2d(
              out_channels, 1, kernel_size=1
          )
      self.to_rgb = nn.Conv2d(out_channels, 3, kernel_size=1)
  
imports: import torch
  from torch import nn
  from functools import partial
  from .basic_blocks import ConvBlock
  from ..ops import FeaturesConnector
label_desc: Use image node_id 1 to create a new UNetDecoder object from inherited base classes: nn with example: obj = UNetDecoder(depth, encoder_blocks_channels, norm_layer, attention_layer, attend_from, image_fusion)