mlreco.models.layers.common.cluster_pool module¶
-
class
mlreco.models.layers.common.cluster_pool.ClusterPool(pooltype='max', p=2)[source]¶ Bases:
torch.nn.modules.module.ModulePyTorch Layer that pools features by cluster assignment options:
- pooltype - how to pool
‘max’ (default) - take max of features ‘sum’ - sum features ‘average’ - average features ‘pnorm’ - p-norm of features
p - norm to use for ‘pnorm’ option (default 2)
- forward method:
- inputs:
features tensor (e.g. from scn sparse tensor) list of clusters
- output:
pytorch tensor of size # clusters x # features
-
__init__(pooltype='max', p=2)[source]¶ Initializes internal Module state, shared by both nn.Module and ScriptModule.
-
forward(features, cs)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
__module__= 'mlreco.models.layers.common.cluster_pool'¶
-
training: bool¶