MCPcopy Create free account
hub / github.com/LayneH/GreenMIM / SparseAvgPool2d

Class SparseAvgPool2d

modeling/sparse_conv_me.py:47–58  ·  view source on GitHub ↗

SparseConv module that operates on torch.Tensor

Source from the content-addressed store, hash-verified

45 return y_s.features.reshape(B, -1, y_s.features.shape[-1])
46
47class SparseAvgPool2d(ME.MinkowskiAvgPooling):
48 '''SparseConv module that operates on torch.Tensor
49 '''
50 def __init__(self, *args, **kwargs) -> None:
51 super().__init__(*args, **kwargs, dimension=2)
52
53 def forward(self, x: torch.Tensor, indexes: torch.Tensor, H: int = None, W: int = None):
54 B, L, C = x.shape
55 x_s = to_sparse_tensor(x, indexes)
56 y_s = super().forward(x_s)
57 # the number of elements might be different
58 return y_s.features.reshape(B, -1, y_s.features.shape[-1])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected