(self, output_size, scales, sampling_ratio,
                 deformable=False, output_channel=256)
Arguments:
            output_size (list[tuple[int]] or list[int]): output size for the pooled region
            scales (list[float]): scales for each Pooler
            sampling_ratio (int): sampling ratio for ROIAlign
Arguments:
            output_size (list[tuple[int]] or list[int]): output size for the pooled region
            scales (list[float]): scales for each Pooler
            sampling_ratio (int): sampling ratio for ROIAlign
Arguments : output_size ( list [ tuple [ int ]] or list [ int ] ) : output size for the pooled region scales ( list [ float ] ) : scales for each Pooler sampling_ratio ( int ) : sampling ratio for ROIAlign
def __init__(self, output_size, scales, sampling_ratio,
                 deformable=False, output_channel=256):
        """
        Arguments:
            output_size (list[tuple[int]] or list[int]): output size for the pooled region
            scales (list[float]): scales for each Pooler
            sampling_ratio (int): sampling ratio for ROIAlign
        """
        super(Pooler, self).__init__()
        poolers = []
        for scale in scales:
            poolers.append(
                ROIAlign(
                    output_size, spatial_scale=scale, sampling_ratio=sampling_ratio
                ) if not deformable else
                DCNPooling(spatial_scale=scale, pooled_size=output_size, no_trans=False,
                           group_size=1, trans_std=0.1, output_dim=output_channel)
            )
        self.poolers = nn.ModuleList(poolers)
        self.output_size = output_size
        # get the levels in the feature map by leveraging the fact that the network always
        # downsamples by a factor of 2 at each level.
        lvl_min = -torch.log2(torch.tensor(scales[0], dtype=torch.float32)).item()
        lvl_max = -torch.log2(torch.tensor(scales[-1], dtype=torch.float32)).item()
        self.map_levels = LevelMapper(lvl_min, lvl_max, canonical_scale=160)
def __init__ ( self , output_size , scales , sampling_ratio , deformable = False , output_channel = 256 ) : super ( Pooler , self ) . __init__ ( ) poolers = [ ] for scale in scales : poolers . append ( ROIAlign ( output_size , spatial_scale = scale , sampling_ratio = sampling_ratio ) if not deformable else DCNPooling ( spatial_scale = scale , pooled_size = output_size , no_trans = False , group_size = 1 , trans_std = 0.1 , output_dim = output_channel ) ) self . poolers = nn . ModuleList ( poolers ) self . output_size = output_size # get the levels in the feature map by leveraging the fact that the network always # downsamples by a factor of 2 at each level. lvl_min = - torch . log2 ( torch . tensor ( scales [ 0 ] , dtype = torch . float32 ) ) . item ( ) lvl_max = - torch . log2 ( torch . tensor ( scales [ - 1 ] , dtype = torch . float32 ) ) . item ( ) self . map_levels = LevelMapper ( lvl_min , lvl_max , canonical_scale = 160 )