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

Method forward

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

x: point features of shape [B, N_feat, 3, N_samples, ...]

(self, x)

Source from the content-addressed store, hash-verified

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
112class VNLinearAndLeakyReLU(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected