I also had this issue recently. In my code, the input and out features size are much larger, and the result is different. I also print out the first 5 elements of each output.
import numpy as np
import torch
from torch import nn

torch.manual_seed(72)

net = nn.Linear(768, 768)
data = torch.rand((128, 768))

print(net(data)[0].mean().item())
print(net(data[:8])[0].mean().item())
print(net(data[:4])[0].mean().item())
print(net(data[:2])[0].mean().item())
print(net(data[:1])[0].mean().item())

print(net(data)[0][:5].tolist())
print(net(data[:8])[0][:5].tolist())
print(net(data[:4])[0][:5].tolist())
print(net(data[:2])[0][:5].tolist())
print(net(data[:1])[0][:5].tolist())

The output is:
0.01415630429983139
0.014156307093799114
0.014156307093799114
0.01415630429983139
0.014156300574541092

[-0.23123368620872498, 0.982639491558075, -0.5261492133140564, 0.32300880551338196, 0.12303455173969269]
[-0.23123352229595184, 0.9826395511627197, -0.5261490345001221, 0.32300886511802673, 0.1230345219373703]
[-0.23123352229595184, 0.9826395511627197, -0.5261490345001221, 0.32300886511802673, 0.1230345219373703]
[-0.23123367130756378, 0.9826394319534302, -0.5261489748954773, 0.32300883531570435, 0.12303447723388672]
[-0.23123368620872498, 0.9826392531394958, -0.5261490941047668, 0.32300883531570435, 0.1230345070362091]

Here the output is different for the same example with different batch sizes. And if we look at the detailed elements in the output, the values may differ starting from the 6th decimal digit. In my application, some difference starts from the 5th decimal digit. How to explain such difference?
Thanks.