GlobalAvgPooling1D

Applies global average pooling for temporal data

class liqfit.modeling.pooling.GlobalAvgPooling1D

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

Parameters:

  • 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 GlobalAvgPooling1D

from liqfit.modeling.pooling import GlobalAvgPooling1D
import torch

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

Last updated