self.pool seems to be missing in your encoder.
Could you check, if that’s the complete code?
Currently your encoder only contains conv layers.
PS: I’ve formatted your code, as it was a bit hard to read. You can add code snippets using three backticks ```