MCPcopy Create free account
hub / github.com/Zhiyuan-R/Tiger-Diffusion / Gather

Class Gather

modules/functional/sampling.py:10–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class Gather(Function):
11 @staticmethod
12 def forward(ctx, features, indices):
13 """
14 Gather
15 :param ctx:
16 :param features: features of points, FloatTensor[B, C, N]
17 :param indices: centers' indices in points, IntTensor[b, m]
18 :return:
19 centers_coords: coordinates of sampled centers, FloatTensor[B, C, M]
20 """
21 features = features.contiguous()
22 indices = indices.int().contiguous()
23 ctx.save_for_backward(indices)
24 ctx.num_points = features.size(-1)
25 return _backend.gather_features_forward(features, indices)
26
27 @staticmethod
28 def backward(ctx, grad_output):
29 indices, = ctx.saved_tensors
30 grad_features = _backend.gather_features_backward(grad_output.contiguous(), indices, ctx.num_points)
31 return grad_features, None
32
33
34gather = Gather.apply

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected