What's the reason of the error ValueError: Expected more than 1 value per channel?

It will fail on batches of size 1 if we use feature-wise batch normalization.

As Batch normalization computes:

y = (x - mean(x)) / (std(x) + eps)

If we have one sample per batch then mean(x) = x, and the output will be entirely zero (ignoring the bias). We can't use that for learning...


To use your trained model, call model.eval() to disable further training. This stops BatchNorm layers from updating their mean and variance, and allows input of just one sample. Use model.train() to resume training mode, if needed.