class_docstr: Bi-Directional Feature Pyramid Network
class_docstr_tok: ["Bi-Directional","Feature","Pyramid","Network"]
code: def __init__(
      self,
      feature_size: int,
      num_feature_maps: int,
      epsilon=0.0001,
      activation=ACT_RELU,
      normalization="batch",
      block: Union[
          Type[BiFPNConvBlock], Type[DepthwiseSeparableConv2dBlock]
      ] = BiFPNConvBlock,
  ):
      super(BiFPNBlock, self).__init__()
  
      self.epsilon = epsilon
      num_blocks = num_feature_maps - 1
  
      self.top_down_blocks = nn.ModuleList(
          [
              block(
                  feature_size,
                  feature_size,
                  activation=activation,
                  normalization=normalization,
              )
              for _ in range(num_blocks)
          ]
      )
      self.bottom_up_blocks = nn.ModuleList(
          [
              block(
                  feature_size,
                  feature_size,
                  activation=activation,
                  normalization=normalization,
              )
              for _ in range(num_blocks)
          ]
      )
  
      self.register_parameter(
          "w1",
          nn.Parameter(torch.Tensor(2, num_blocks), requires_grad=True),
      )
      self.register_parameter(
          "w2",
          nn.Parameter(torch.Tensor(3, num_blocks), requires_grad=True),
      )
  
      torch.nn.init.constant_(self.w1, 1)
      torch.nn.init.constant_(self.w2, 1)
  
imports: from typing import List, Tuple, Union, Type, Callable
  import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
  from pytorch_toolbelt.modules.activations import ACT_RELU, instantiate_activation_block
  from pytorch_toolbelt.modules.simple import conv1x1
  from pytorch_toolbelt.modules.dsconv import DepthwiseSeparableConv2dBlock
  from pytorch_toolbelt.modules.interfaces import AbstractDecoder, FeatureMapsSpecification
  from pytorch_toolbelt.modules.normalization import NORM_BATCH, instantiate_normalization_block
label_desc: Use image node_id 1 to create a new BiFPNBlock object from inherited base classes: nn with example: obj = BiFPNBlock(feature_size, num_feature_maps, epsilon, activation, normalization, block)