class_docstr: Attention Unet based on
  Otkay et al. "Attention U-Net: Learning Where to Look for the Pancreas"
  https://arxiv.org/abs/1804.03999
  
  Args:
      spatial_dims: number of spatial dimensions of the input image.
      in_channels: number of the input channel.
      out_channels: number of the output classes.
      channels (Sequence[int]): sequence of channels. Top block first. The length of `channels` should be no less than 2.
      strides (Sequence[int]): stride to use for convolutions.
      kernel_size: convolution kernel size.
      up_kernel_size: convolution kernel size for transposed convolution layers.
      dropout: dropout ratio. Defaults to no dropout.
class_docstr_tok: ["Attention","Unet","based","on","Otkay","et","al",".","``","Attention","U-Net",":","Learning","Where","to","Look","for","the","Pancreas","''","https",":","\/\/arxiv.org\/abs\/1804.03999","Args",":","spatial_dims",":","number","of","spatial","dimensions","of","the","input","image",".","in_channels",":","number","of","the","input","channel",".","out_channels",":","number","of","the","output","classes",".","channels","(","Sequence","[","int","]",")",":","sequence","of","channels",".","Top","block","first",".","The","length","of","`","channels","`","should","be","no","less","than","2.","strides","(","Sequence","[","int","]",")",":","stride","to","use","for","convolutions",".","kernel_size",":","convolution","kernel","size",".","up_kernel_size",":","convolution","kernel","size","for","transposed","convolution","layers",".","dropout",":","dropout","ratio",".","Defaults","to","no","dropout","."]
code: def __init__(
      self,
      spatial_dims: int,
      in_channels: int,
      out_channels: int,
      channels: Sequence[int],
      strides: Sequence[int],
      kernel_size: Sequence[int] | int = 3,
      up_kernel_size: Sequence[int] | int = 3,
      dropout: float = 0.0,
  ):
      super().__init__()
      self.dimensions = spatial_dims
      self.in_channels = in_channels
      self.out_channels = out_channels
      self.channels = channels
      self.strides = strides
      self.kernel_size = kernel_size
      self.dropout = dropout
  
      head = ConvBlock(
          spatial_dims=spatial_dims,
          in_channels=in_channels,
          out_channels=channels[0],
          dropout=dropout,
      )
      reduce_channels = Convolution(
          spatial_dims=spatial_dims,
          in_channels=channels[0],
          out_channels=out_channels,
          kernel_size=1,
          strides=1,
          padding=0,
          conv_only=True,
      )
      self.up_kernel_size = up_kernel_size
  
      def _create_block(
          channels: Sequence[int], strides: Sequence[int]
      ) -> nn.Module:
          if len(channels) > 2:
              subblock = _create_block(channels[1:], strides[1:])
              return AttentionLayer(
                  spatial_dims=spatial_dims,
                  in_channels=channels[0],
                  out_channels=channels[1],
                  submodule=nn.Sequential(
                      ConvBlock(
                          spatial_dims=spatial_dims,
                          in_channels=channels[0],
                          out_channels=channels[1],
                          strides=strides[0],
                          dropout=self.dropout,
                      ),
                      subblock,
                  ),
                  up_kernel_size=self.up_kernel_size,
                  strides=strides[0],
                  dropout=dropout,
              )
          else:
              # the next layer is the bottom so stop recursion,
              # create the bottom layer as the subblock for this layer
              return self._get_bottom_layer(
                  channels[0], channels[1], strides[0]
              )
  
      encdec = _create_block(self.channels, self.strides)
      self.model = nn.Sequential(head, encdec, reduce_channels)
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  import torch
  import torch.nn
  from monai.networks.blocks.convolutions import Convolution
  from monai.networks.layers.factories import Norm
label_desc: Use image node_id 1 to create a new AttentionUnet object from inherited base classes: nn with example: obj = AttentionUnet(spatial_dims, in_channels, out_channels, channels, strides, kernel_size, up_kernel_size, dropout)