I’m not sure if this is what you’re looking for, but you can turn training mode off for BatchNorm1d and then it’ll take inputs with minibatch size 1:
m = nn.BatchNorm1d(100)
m.train(False)
input = autograd.Variable(torch.randn(1, 100))
output = m(input)