I’m not sure which implementation you are using and where you are passing hiddens and flatten, as the torchvision AlexNet implementation doesn’t support these arguments, if I’m not mistaken, and expects the inputs to have the spatial shape 224x224 as seen here:
model = models.alexnet()
x = torch.randn(1, 3, 224, 224)
out = model(x)
print(out.shape)
> torch.Size([1, 1000])