You could achieve this behavior using the nn.Linear layer.
Just permute your input, so that your dimensions are [batch_size, seq, in_features] and the linear layer will be applied for all seq using in_features.
Have a look at the doc 1 for the shape information.