Hi,
Sure you can use matmul to do batch of matrix matrix multiplications:
import torch
from torch.nn import functional as F
X = torch.rand(5, 10)
W = torch.rand(5, 6, 10)
output = torch.Tensor(5, 6)
for i in range(5):
    output[i] = F.linear(X[i], W[i], None)

fast_output =  torch.matmul(X.unsqueeze(1), W.transpose(-1, -2)).squeeze(1)
print((output - fast_output).abs().max())