I don’t know which EfficientNet implementation you are using, so I cannot reproduce this error directly.
However, checking the efficientnet_b5 from the timm repository works after some changes to the architecture:
class ENET(nn.Module):
    def __init__(self):
        super(ENET, self).__init__()
        
        self.ENet = ENet
    
        #disect the network to access its last convolutional layer
        self.head0 = nn.Sequential(*list(self.ENet.children())[:4])
        self.BN =  nn.BatchNorm2d(512, eps=0.001, momentum=0.010000000000000009, affine=True, track_running_stats=True)
        self.tail = nn.Sequential(*list(self.ENet.children())[4:])


    def forward(self, x):
        x = self.head0(x)
        x = self.BN(x)
        #x = x.view((1, -1))
        x = self.tail(x)
        return x


ENet = efficientnet_b5()
model = ENET()
model.eval()
pred = model(torch.randn(1, 3, 224, 224))