The error is raised in the src.expand_as(other) operation, since the shape of other cannot be used to expand src, so you would need to check the input shapes for this particular operation and make sure they match the expected shapes.
PS: you can post code snippets by wrapping them into three backticks ```, which would make debugging easier and would also allow the forum search to index the code.