peal.architectures.basic_modules.Mean

class peal.architectures.basic_modules.Mean[source]

Bases: Module

Average over a set of dimensions (global average pooling by default).

Parameters:
  • dims (list of int, optional) – Dimensions to reduce sequentially. If None, every dimension from 2 upwards is reduced in reverse order, i.e. all spatial axes of an (N, C, ...) tensor.

  • keepdim (bool, default False) – Passed to torch.mean.

  • input_shape (list, optional) – Initial value of the input_shape attribute; overwritten on every forward pass with [-1] + list(x.shape[1:]) so that inverse (un-pooling) layers can look it up.

Methods

forward

Record input_shape and reduce x over the configured dims.

__init__(dims=None, keepdim=False, input_shape=None)[source]
forward(x)[source]

Record input_shape and reduce x over the configured dims.