The posted code snippet does not reproduce the issue and will raise an error in:
print(y.size())
> AttributeError: 'tuple' object has no attribute 'size'

since the forward method is returning a tuple.
Could you post a code snippet, which would reproduce this issue, please?
PS: you can post code snippets by wrapping them into three backticks ```, which would make debugging easier.