RuntimeError: The expanded size of the tensor (1) must match the existing size (2432) at non-singleton dimension 1. Target sizes: [2432, 1, 256]. Tensor sizes: [1, 2432, 1]

Hi,

I am getting the following error when performing the GAT operator specifically in “loss = train (,)” line:

This is what train does:

Full error:


Could you please help me out to solve this error. Thank you!

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.

1 Like

Thank you for your reply.