Applies global absolute max pooling for temporal data

class liqfit.modeling.pooling.GlobalAbsMaxPooling1D

forward(x: torch.Tensor, attention_mask: torch.Tensor)


  • x (torch.Tensor): Input tensor to apply pooling on. Expected shape: (B, T, E).

  • attention_mask (torch.Tensor): Mask tensor to mask out the padding while applying the pooling. Expected shape: (B, T)

Using GlobalMaxPooling1D

from liqfit.modeling.pooling import GlobalAbsMaxPooling1D
import torch

x = torch.randn((1, 10, 20))
pooler = GlobalAbsMaxPooling1D()
out = pooler(x)

Last updated