Call model.eval() before passing single samples to the model.
This will make sure to use the running stats in the batch norm layers and should avoid this error.
PS: don’t forget to add a batch dimension even to a single sample.