Thanks for posting the code. Unfortunately, it’s unclear to me how to reproduce the issue, as you’ve posted >800 lines of code.
The model, which seems to raise the issue works fine for an input in the shape [batch_size, 3, 256, 256]:
model = EmbeddingNet()
x = torch.randn(1, 3, 256, 256)
out = model(x)

so my guess would be that (some) of your inputs do not have this expected shape.
In case you are still stuck, try to reduce the number of lines of code and post an executable code snippet, which would raise the same error.