class_docstr: DAF3D network based on 'Deep Attentive Features for Prostate Segmentation in 3D Transrectal Ultrasound'
  <https://arxiv.org/pdf/1907.01743.pdf>.
  The network consists of a 3D Feature Pyramid Network which is applied on the feature maps of a 3D ResNet,
  followed by a custom Attention Module and an ASPP module.
  During training the supervised signal consists of the outputs of the FPN (four Single Layer Features, SLFs),
  the outputs of the attention module (four Attentive Features) and the final prediction.
  They are individually compared to the ground truth, the final loss consists of a weighted sum of all
  individual losses (see DAF3D tutorial for details).
  There is an additional possiblity to return all supervised signals as well as the Attentive Maps in validation
  mode to visualize inner functionality of the network.
  
  Args:
      in_channels: number of input channels.
      out_channels: number of output channels.
      visual_output: whether to return all SLFs, Attentive Maps, Refined SLFs in validation mode
          can be used to visualize inner functionality of the network
class_docstr_tok: ["DAF3D","network","based","on","'Deep","Attentive","Features","for","Prostate","Segmentation","in","3D","Transrectal","Ultrasound'","<","https",":","\/\/arxiv.org\/pdf\/1907.01743.pdf",">",".","The","network","consists","of","a","3D","Feature","Pyramid","Network","which","is","applied","on","the","feature","maps","of","a","3D","ResNet",",","followed","by","a","custom","Attention","Module","and","an","ASPP","module",".","During","training","the","supervised","signal","consists","of","the","outputs","of","the","FPN","(","four","Single","Layer","Features",",","SLFs",")",",","the","outputs","of","the","attention","module","(","four","Attentive","Features",")","and","the","final","prediction",".","They","are","individually","compared","to","the","ground","truth",",","the","final","loss","consists","of","a","weighted","sum","of","all","individual","losses","(","see","DAF3D","tutorial","for","details",")",".","There","is","an","additional","possiblity","to","return","all","supervised","signals","as","well","as","the","Attentive","Maps","in","validation","mode","to","visualize","inner","functionality","of","the","network",".","Args",":","in_channels",":","number","of","input","channels",".","out_channels",":","number","of","output","channels",".","visual_output",":","whether","to","return","all","SLFs",",","Attentive","Maps",",","Refined","SLFs","in","validation","mode","can","be","used","to","visualize","inner","functionality","of","the","network"]
code: def __init__(self, in_channels, out_channels, visual_output=False):
      super().__init__()
      self.visual_output = visual_output
      self.backbone_with_fpn = Daf3dBackboneWithFPN(
          backbone=Daf3dBackbone(in_channels),
          return_layers={
              "layer1": "feat1",
              "layer2": "feat2",
              "layer3": "feat3",
              "layer4": "feat4",
          },
          in_channels_list=[256, 512, 1024, 2048],
          out_channels=128,
          spatial_dims=3,
      )
      self.predict1 = nn.Conv3d(128, out_channels, kernel_size=1)
  
      group_norm = ("group", {"num_groups": 32, "num_channels": 64})
      act_prelu = ("prelu", {"num_parameters": 1, "init": 0.25})
      self.fuse = nn.Sequential(
          Convolution(
              spatial_dims=3,
              in_channels=512,
              out_channels=64,
              kernel_size=1,
              adn_ordering="NA",
              norm=group_norm,
              act=act_prelu,
          ),
          Convolution(
              spatial_dims=3,
              in_channels=64,
              out_channels=64,
              kernel_size=3,
              adn_ordering="NA",
              padding=1,
              norm=group_norm,
              act=act_prelu,
          ),
          Convolution(
              spatial_dims=3,
              in_channels=64,
              out_channels=64,
              kernel_size=3,
              adn_ordering="NA",
              padding=1,
              norm=group_norm,
              act=act_prelu,
          ),
      )
      self.attention = AttentionModule(
          spatial_dims=3,
          in_channels=192,
          out_channels=64,
          norm=group_norm,
          act=act_prelu,
      )
  
      self.refine = Convolution(
          3,
          256,
          64,
          kernel_size=1,
          adn_ordering="NA",
          norm=group_norm,
          act=act_prelu,
      )
      self.predict2 = nn.Conv3d(64, out_channels, kernel_size=1)
      self.aspp = Daf3dASPP(
          spatial_dims=3,
          in_channels=64,
          conv_out_channels=64,
          out_channels=64,
          kernel_sizes=(3, 3, 3, 3),
          dilations=((1, 1, 1), (1, 6, 6), (1, 12, 12), (1, 18, 18)),  # type: ignore
          norm_type=group_norm,
          acti_type=None,
          bias=True,
      )
  
imports: from __future__ import annotations
  from collections import OrderedDict
  from collections.abc import Callable, Sequence
  import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
  from monai.networks.blocks import ADN
  from monai.networks.blocks.aspp import SimpleASPP
  from monai.networks.blocks.backbone_fpn_utils import BackboneWithFPN
  from monai.networks.blocks.convolutions import Convolution
  from monai.networks.blocks.feature_pyramid_network import ExtraFPNBlock, FeaturePyramidNetwork
  from monai.networks.layers.factories import Conv, Norm
  from monai.networks.nets.resnet import ResNet, ResNetBottleneck
label_desc: Use image node_id 1 to create a new DAF3D object from inherited base classes: nn with example: obj = DAF3D(in_channels, out_channels, visual_output)