In sequence classification tasks (e.g., spam detection with a transformer), the model often outputs a 3D tensor of shape (batch_size, seq_len, num_classes) containing per-token logits. To obtain a single prediction per sample, a common strategy is to average the logits across the sequence dimension, producing a 2D tensor of shape (batch_size, num_classes).
Implement a function mean_pool(logits) that takes a 3D NumPy array of shape (batch_size, seq_len, num_classes) and returns a 2D NumPy array of shape (batch_size, num_classes) by averaging along the sequence dimension. Round the result to 4 decimal places and return it as a nested Python list (via .tolist()).