# GeneralizedMeanPooling¶

class mmcls.models.GeneralizedMeanPooling(p=3.0, eps=1e-06, clamp=True)[source]

Generalized Mean Pooling neck.

Note that we use view to remove extra channel after pooling. We do not use squeeze as it will also remove the batch dimension when the tensor has a batch dimension of size 1, which can lead to unexpected errors.

Parameters
• p (float) – Parameter value. Default: 3.

• eps (float) – epsilon. Default: 1e-6

• clamp (bool) – Use clamp before pooling. Default: True

forward(inputs)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.