I copy-pasted your model definition and used a random input tensor, which yields the desired output shape. I don’t know, if I had to change something else, but if so, it might be a typo.
Is my code snippet not running with your code?