Exemplo n.º 1
0
  def __init__(self,
               inc,
               outc,
               inner_inc,
               inner_outc,
               inner_module=None,
               depth=1,
               bn_momentum=0.05,
               dimension=-1):
    ME.MinkowskiNetwork.__init__(self, dimension)
    self.depth = depth

    self.conv = nn.Sequential(
        conv_norm_non(
            inc,
            inner_inc,
            3,
            2,
            dimension,
            region_type=self.REGION_TYPE,
            norm_type=self.NORM_TYPE,
            nonlinearity=self.NONLINEARITY), *[
                get_block(
                    self.NORM_TYPE,
                    inner_inc,
                    inner_inc,
                    bn_momentum=bn_momentum,
                    region_type=self.REGION_TYPE,
                    dimension=dimension) for d in range(depth)
            ])
    self.inner_module = inner_module
    self.convtr = nn.Sequential(
        conv_tr(
            in_channels=inner_outc,
            out_channels=inner_outc,
            kernel_size=3,
            stride=2,
            dilation=1,
            has_bias=False,
            region_type=self.REGION_TYPE,
            dimension=dimension),
        get_norm(
            self.NORM_TYPE, inner_outc, bn_momentum=bn_momentum, dimension=dimension),
        get_nonlinearity(self.NONLINEARITY))

    self.cat_conv = conv_norm_non(
        inner_outc + inc,
        outc,
        1,
        1,
        dimension,
        norm_type=self.NORM_TYPE,
        nonlinearity=self.NONLINEARITY)
Exemplo n.º 2
0
def conv_norm_non(inc,
                  outc,
                  kernel_size,
                  stride,
                  dimension,
                  bn_momentum=0.05,
                  region_type=ME.RegionType.HYPER_CUBE,
                  norm_type='BN',
                  nonlinearity='ELU'):
    return nn.Sequential(
        conv(in_channels=inc,
             out_channels=outc,
             kernel_size=kernel_size,
             stride=stride,
             dilation=1,
             bias=False,
             region_type=region_type,
             dimension=dimension),
        get_norm(norm_type, outc, bn_momentum=bn_momentum,
                 dimension=dimension), get_nonlinearity(nonlinearity))