MCPcopy Create free account
hub / github.com/VAST-AI-Research/TriplaneGaussian / forward

Method forward

tgs/models/snowflake/utils.py:239–263  ·  view source on GitHub ↗

Args: xyz1: Tensor, (B, 3, N) xyz2: Tensor, (B, 3, M) points1: Tensor, (B, in_channel, N) points2: Tensor, (B, in_channel, M) Returns:MLP_CONV new_points: Tensor, (B, mlp[-1], N)

(self, xyz1, xyz2, points1, points2)

Source from the content-addressed store, hash-verified

237 self.mlp_conv = nn.Sequential(*self.mlp_conv)
238
239 def forward(self, xyz1, xyz2, points1, points2):
240 """
241 Args:
242 xyz1: Tensor, (B, 3, N)
243 xyz2: Tensor, (B, 3, M)
244 points1: Tensor, (B, in_channel, N)
245 points2: Tensor, (B, in_channel, M)
246
247 Returns:MLP_CONV
248 new_points: Tensor, (B, mlp[-1], N)
249 """
250 dist, idx = three_nn(xyz1.permute(0, 2, 1).contiguous(), xyz2.permute(0, 2, 1).contiguous())
251 dist = torch.clamp_min(dist, 1e-10) # (B, N, 3)
252 recip_dist = 1.0/dist
253 norm = torch.sum(recip_dist, 2, keepdim=True).repeat((1, 1, 3))
254 weight = recip_dist / norm
255 interpolated_points = three_interpolate(points2, idx, weight) # B, in_channel, N
256
257 if self.use_points1:
258 new_points = torch.cat([interpolated_points, points1], 1)
259 else:
260 new_points = interpolated_points
261
262 new_points = self.mlp_conv(new_points)
263 return new_points
264
265
266def square_distance(src, dst):

Callers

nothing calls this directly

Calls 2

three_nnFunction · 0.85
three_interpolateFunction · 0.85

Tested by

no test coverage detected