MCPcopy Create free account
hub / github.com/TEA-Lab/TwoByTwo / VNLinearAndLeakyReLU

Class VNLinearAndLeakyReLU

src/shape_assembly/models/encoder/vn_layers.py:112–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110
111
112class VNLinearAndLeakyReLU(nn.Module):
113 def __init__(self, in_channels, out_channels, dim=5, share_nonlinearity=False, use_batchnorm='norm',
114 negative_slope=0.2):
115 super(VNLinearLeakyReLU, self).__init__()
116 self.dim = dim
117 self.share_nonlinearity = share_nonlinearity
118 self.use_batchnorm = use_batchnorm
119 self.negative_slope = negative_slope
120
121 self.linear = VNLinear(in_channels, out_channels)
122 self.leaky_relu = VNLeakyReLU(out_channels, share_nonlinearity=share_nonlinearity,
123 negative_slope=negative_slope)
124
125 # BatchNorm
126 self.use_batchnorm = use_batchnorm
127 if use_batchnorm != 'none':
128 self.batchnorm = VNBatchNorm(out_channels, dim=dim, mode=use_batchnorm)
129
130 def forward(self, x):
131 '''
132 x: point features of shape [B, N_feat, 3, N_samples, ...]
133 '''
134 # Conv
135 x = self.linear(x)
136 # InstanceNorm
137 if self.use_batchnorm != 'none':
138 x = self.batchnorm(x)
139 # LeakyReLU
140 x_out = self.leaky_relu(x)
141 return x_out
142
143
144class VNBatchNorm(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected