x: point features of shape [B, N_feat, 3, N_samples, ...]
(self, x)
| 92 | self.map_to_dir = nn.Linear(in_channels, out_channels, bias=False) |
| 93 | |
| 94 | def forward(self, x): |
| 95 | ''' |
| 96 | x: point features of shape [B, N_feat, 3, N_samples, ...] |
| 97 | ''' |
| 98 | # Linear |
| 99 | p = self.map_to_feat(x.transpose(1, -1)).transpose(1, -1) |
| 100 | # BatchNorm |
| 101 | p = self.batchnorm(p) |
| 102 | # LeakyReLU |
| 103 | d = self.map_to_dir(x.transpose(1, -1)).transpose(1, -1) |
| 104 | dotprod = (p * d).sum(2, keepdims=True) |
| 105 | mask = (dotprod >= 0).float() |
| 106 | d_norm_sq = (d * d).sum(2, keepdims=True) |
| 107 | x_out = self.negative_slope * p + (1 - self.negative_slope) * ( |
| 108 | mask * p + (1 - mask) * (p - (dotprod / (d_norm_sq + EPS)) * d)) |
| 109 | return x_out |
| 110 | |
| 111 | |
| 112 | class VNLinearAndLeakyReLU(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected