The forward method seems to be outside of the model definition, so you would have to add an indentation.
PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier.