I have a 1D convolutional model with batch norm layers, and it doesn’t seem to like me predicting on a single sample, even when in eval mode. Predicting on more than 1 sample works fine, but I get the following error from predicting on a single sample:
ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 1024])
I’ve seen lots of posts about handling this error when not in eval mode, which makes sense, but I haven’t seen anything on handling this error when already in eval mode.
Here is a section of the model architecture showing one of the batch norm layers:
(conv6): Conv1d(256, 256, kernel_size=(3,), stride=(1,), padding=(1,))
(maxp6): MaxPool1d(kernel_size=3, stride=1, padding=1, dilation=1, ceil_mode=False)
(fc1): Linear(in_features=2560, out_features=1024, bias=True)
(bn1): BatchNorm1d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=False)
(drop1): Dropout(p=0.5, inplace=False)
Any ideas?